-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWorkbenchCatalogTests.cs
More file actions
45 lines (36 loc) · 1.92 KB
/
WorkbenchCatalogTests.cs
File metadata and controls
45 lines (36 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using DotPilot.Runtime.Features.Workbench;
namespace DotPilot.Tests;
public class WorkbenchCatalogTests
{
[Test]
public void GetSnapshotUsesLiveWorkspaceAndRespectsIgnoreRules()
{
using var workspace = TemporaryWorkbenchDirectory.Create();
var snapshot = CreateWorkbenchCatalog(workspace.Root).GetSnapshot();
snapshot.WorkspaceRoot.Should().Be(workspace.Root);
snapshot.RepositoryNodes.Should().Contain(node => node.RelativePath == "src/MainPage.xaml");
snapshot.RepositoryNodes.Should().Contain(node => node.RelativePath == "src/SettingsPage.xaml");
snapshot.RepositoryNodes.Should().NotContain(node => node.RelativePath.Contains("ignored", StringComparison.OrdinalIgnoreCase));
snapshot.RepositoryNodes.Should().NotContain(node => node.RelativePath.EndsWith(".tmp", StringComparison.OrdinalIgnoreCase));
snapshot.Documents.Should().Contain(document => document.RelativePath == "src/MainPage.xaml");
snapshot.SettingsCategories.Should().Contain(category => category.Key == "providers");
snapshot.Logs.Should().HaveCount(4);
}
[Test]
public void GetSnapshotFallsBackToSeededDataWhenWorkspaceHasNoSupportedDocuments()
{
using var workspace = TemporaryWorkbenchDirectory.Create(includeSupportedFiles: false);
var snapshot = CreateWorkbenchCatalog(workspace.Root).GetSnapshot();
snapshot.WorkspaceName.Should().Be("Browser sandbox");
snapshot.Documents.Should().NotBeEmpty();
snapshot.RepositoryNodes.Should().Contain(node => node.RelativePath == "DotPilot/Presentation/MainPage.xaml");
}
private static WorkbenchCatalog CreateWorkbenchCatalog(string workspaceRoot)
{
return new WorkbenchCatalog(CreateRuntimeFoundationCatalog(), workspaceRoot);
}
private static RuntimeFoundationCatalog CreateRuntimeFoundationCatalog()
{
return new RuntimeFoundationCatalog();
}
}