public void QualifiedPathsWithSameCaseInsensitiveRoot_AndDifferingCase_AreEqual() { var root = new LocalRoot(new Uri(@"C:\"), FileSystemCasing.CasePreservingInsensitive); var a = new QualifiedPath(root, RelativePath.CreateFromSegments("a", "b", "c")); var b = new QualifiedPath(root, RelativePath.CreateFromSegments("A", "B", "C")); Assert.That(a, Is.EqualTo(b).Using(default(QualifiedPath.DefaultEqualityComparer))); }
public void QualifiedPathsWithDifferentRoots_AreNotEqual([ValueSource(nameof(ValidFileSystemCasings))] FileSystemCasing casing) { var relativePath = RelativePath.CreateFromSegments("a", "b", "c"); var a = new QualifiedPath(new LocalRoot(new Uri(@"C:\"), casing), relativePath); var b = new QualifiedPath(new LocalRoot(new Uri(@"E:\"), casing), relativePath); Assert.That(a, Is.Not.EqualTo(b).Using(default(QualifiedPath.DefaultEqualityComparer))); }
public void DoesNotMapExcludedPath() { var builder = new StorageHierarchiesBuilder(new StubFileSystemApi()); var root = builder.CreateNode(@"C:\Root", FileSystemCasing.CasePreservingInsensitive); builder.AddNamedRoot("Root", root); var regex = new GlobToRegexCompiler().CompileRegex("**/.caber/**", FileSystemCasing.CaseSensitive); builder.AddFilter(root, new RelativePathMatcher(regex, FilterRule.Exclude)); var storage = builder.BuildHierarchies(); var qualifiedPath = new QualifiedPath(root, RelativePath.CreateFromSegments(".caber", "tempfile")); Assert.That(storage.MapToAbstractPath(qualifiedPath), Is.Null); }
public void RoundtripsAbstractPathInRootWithNoGrafts() { var builder = new StorageHierarchiesBuilder(new StubFileSystemApi()); var root = builder.CreateNode(@"C:\Root", FileSystemCasing.CasePreservingInsensitive); builder.AddNamedRoot("SimpleRoot", root); var storage = builder.BuildHierarchies(); var qualifiedPath = new QualifiedPath(root, RelativePath.CreateFromSegments("some", "filepath.txt")); var expectedAbstractPath = new AbstractPath(storage.NamedRoots.Single(), RelativePath.CreateFromSegments("some", "filepath.txt")); var abstractPath = storage.MapToAbstractPath(qualifiedPath); Assert.That(abstractPath, Is.EqualTo(expectedAbstractPath).Using(default(AbstractPath.DefaultEqualityComparer))); Assert.That(storage.MapFromAbstractPath(abstractPath), Is.EqualTo(qualifiedPath) .Using(default(QualifiedPath.DefaultEqualityComparer))); }
/// <summary> /// Constructor of /// qualifiedIndexName: (UserDefinedWord QualifiedNameSeparator)+ TcHeadDefiniiton=UserDefinedWord /// </summary> /// <param name="path"></param> /// <param name="tcHeadDefinition"></param> public QualifiedIndexName(QualifiedPath path, Token tcHeadDefinition) { this.Path = path; this.TcHeadDefinition = tcHeadDefinition; }