68 lines
2.9 KiB
C#
68 lines
2.9 KiB
C#
namespace Explorer.Hosting.Tests;
|
|
|
|
public class ProjectGraphTests
|
|
{
|
|
[Fact]
|
|
public void App_references_client_not_host_runtime_or_plugin_implementations()
|
|
{
|
|
var csproj = File.ReadAllText(Path.Combine(RepoRoot(), "src", "Explorer.App", "Explorer.App.csproj"));
|
|
Assert.Contains("Explorer.Hosting.Client", csproj);
|
|
Assert.Contains("Explorer.Presentation", csproj);
|
|
Assert.DoesNotContain("Explorer.Hosting\\Explorer.Hosting.csproj", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.OneDrive", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.GoogleDrive", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.Nextcloud", csproj);
|
|
Assert.DoesNotContain("Explorer.Indexing", csproj);
|
|
}
|
|
|
|
[Fact]
|
|
public void Client_does_not_reference_plugin_implementations_or_scanners()
|
|
{
|
|
var csproj = File.ReadAllText(Path.Combine(RepoRoot(), "src", "Explorer.Hosting.Client", "Explorer.Hosting.Client.csproj"));
|
|
Assert.Contains("Explorer.Plugin.Abstractions", csproj);
|
|
Assert.Contains("Explorer.Storage.Sqlite", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.OneDrive", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.GoogleDrive", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.Nextcloud", csproj);
|
|
Assert.DoesNotContain("Explorer.Indexing", csproj);
|
|
Assert.DoesNotContain("Explorer.Hosting\\Explorer.Hosting.csproj", csproj);
|
|
}
|
|
|
|
[Fact]
|
|
public void Host_runtime_owns_plugins_and_references_the_client()
|
|
{
|
|
var csproj = File.ReadAllText(Path.Combine(RepoRoot(), "src", "Explorer.Hosting", "Explorer.Hosting.csproj"));
|
|
Assert.Contains("Explorer.Hosting.Client", csproj);
|
|
Assert.Contains("Explorer.Plugin.OneDrive", csproj);
|
|
Assert.Contains("Explorer.Plugin.GoogleDrive", csproj);
|
|
Assert.Contains("Explorer.Plugin.Nextcloud", csproj);
|
|
Assert.Contains("Explorer.Indexing", csproj);
|
|
}
|
|
|
|
[Fact]
|
|
public void Presentation_may_reference_plugin_abstractions_not_implementations()
|
|
{
|
|
var csproj = File.ReadAllText(Path.Combine(RepoRoot(), "src", "Explorer.Presentation", "Explorer.Presentation.csproj"));
|
|
Assert.Contains("Explorer.Plugin.Abstractions", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.OneDrive", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.GoogleDrive", csproj);
|
|
Assert.DoesNotContain("Explorer.Plugin.Nextcloud", csproj);
|
|
}
|
|
|
|
private static string RepoRoot()
|
|
{
|
|
var dir = new DirectoryInfo(AppContext.BaseDirectory);
|
|
while (dir is not null)
|
|
{
|
|
if (File.Exists(Path.Combine(dir.FullName, "Explorer.slnx")))
|
|
{
|
|
return dir.FullName;
|
|
}
|
|
|
|
dir = dir.Parent;
|
|
}
|
|
|
|
throw new InvalidOperationException("Could not find Explorer.slnx above " + AppContext.BaseDirectory);
|
|
}
|
|
}
|