Ejemplo n.º 1
0
        public void PathWithInvalidRecursiveWildCardSearch()
        {
            // Arrange
            var path           = @"**foo\bar";
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = _basePath, SearchPattern = @"foo\bar", SearchOption = SearchOption.AllDirectories
            };;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 2
0
        public void PathWithLocalFileAndLeadingDirectorySepReturnSingleResult()
        {
            // Arrange
            var path           = "\\foo.txt";
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = _basePath, SearchPattern = "foo.txt", SearchOption = SearchOption.TopDirectoryOnly
            };;

            // Act
            PathSearchFilter searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 3
0
        public void PathWithRecursiveWildCardSearchContainingNoLeadingDirectory()
        {
            // Arrange
            var path           = @"**\*.txt";
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = _basePath, SearchPattern = "*.txt", SearchOption = SearchOption.AllDirectories
            };;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 4
0
        public void PathWithRecursiveWildCardSearchContainingNoExtension()
        {
            // Arrange
            var path           = @"foo\**\*";
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = Path.Combine(_basePath, "foo"), SearchPattern = "*", SearchOption = SearchOption.AllDirectories
            };

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 5
0
        public void RootedPathWithRecursiveWildCard()
        {
            // Arrange
            var path           = @"x:\foo\bar\**\*.cs";
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = @"x:\foo\bar", SearchPattern = @"*.cs", SearchOption = SearchOption.AllDirectories
            };;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(@"C:\project-files", path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 6
0
        public void PathWithWildCardFileName()
        {
            // Arrange
            var path           = "*.foo";
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = _basePath, SearchPattern = "*.foo", SearchOption = SearchOption.TopDirectoryOnly
            };;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 7
0
        public void PathWithDirectoryAndWildCardFileName()
        {
            // Arrange
            var path           = "\\bar\\foo\\*.baz";
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = Path.Combine(_basePath, "bar\\foo"), SearchPattern = "*.baz", SearchOption = SearchOption.TopDirectoryOnly
            };

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 8
0
        public void RootedFilePathReturnSingleResult()
        {
            // Arrange
            var path           = "Y:\\foo\\bar.txt";
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = "Y:\\foo", SearchPattern = "bar.txt", SearchOption = SearchOption.TopDirectoryOnly
            };;

            // Act
            PathSearchFilter searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 9
0
        public void RelativePathWildCardExtension()
        {
            // Arrange
            var path           = "..\\..\\bar\\baz\\*.foo";
            var directory      = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(_basePath)), "bar\\baz");
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = directory, SearchPattern = "*.foo", SearchOption = SearchOption.TopDirectoryOnly
            };;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 10
0
        public void RelativeFilePathReturnSingleResult()
        {
            // Arrange
            var path           = "..\\..\\foo.txt";
            var directory      = Path.GetDirectoryName(Path.GetDirectoryName(_basePath));
            var expectedFilter = new PathSearchFilter {
                SearchDirectory = directory, SearchPattern = "foo.txt", SearchOption = SearchOption.TopDirectoryOnly
            };;

            // Act
            PathSearchFilter searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 11
0
        public void RootedFilePathReturnSingleResult()
        {
            // Arrange
            var path = "Y:\\foo\\bar.txt";
            var expectedFilter = new PathSearchFilter { SearchDirectory = "Y:\\foo", SearchPattern = "bar.txt", SearchOption = SearchOption.TopDirectoryOnly }; ;

            // Act
            PathSearchFilter searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 12
0
        public void RelativePathWildCardExtension()
        {
            // Arrange
            var path = "..\\..\\bar\\baz\\*.foo";
            var directory = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(_basePath)), "bar\\baz");
            var expectedFilter = new PathSearchFilter { SearchDirectory = directory, SearchPattern = "*.foo", SearchOption = SearchOption.TopDirectoryOnly }; ;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 13
0
        public void RelativeFilePathReturnSingleResult()
        {
            // Arrange
            var path = "..\\..\\foo.txt";
            var directory = Path.GetDirectoryName(Path.GetDirectoryName(_basePath));
            var expectedFilter = new PathSearchFilter { SearchDirectory = directory, SearchPattern = "foo.txt", SearchOption = SearchOption.TopDirectoryOnly }; ;

            // Act
            PathSearchFilter searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 14
0
        public void PathWithWildCardFileNameAndExtension()
        {
            // Arrange
            var path = "*.*";
            var expectedFilter = new PathSearchFilter { SearchDirectory = _basePath, SearchPattern = "*.*", SearchOption = SearchOption.TopDirectoryOnly }; ;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 15
0
        public void PathWithRecursiveWildCardSearchContainingNoLeadingDirectory()
        {
            // Arrange
            var path = @"**\*.txt";
            var expectedFilter = new PathSearchFilter { SearchDirectory = _basePath, SearchPattern = "*.txt", SearchOption = SearchOption.AllDirectories }; ;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 16
0
        public void PathWithRecursiveWildCardSearchContainingNoExtension()
        {
            // Arrange
            var path = @"foo\**\*";
            var expectedFilter = new PathSearchFilter { SearchDirectory = Path.Combine(_basePath, "foo"), SearchPattern = "*", SearchOption = SearchOption.AllDirectories };

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 17
0
        public void PathWithLocalFileAndLeadingDirectorySepReturnSingleResult()
        {
            // Arrange
            var path = "\\foo.txt";
            var expectedFilter = new PathSearchFilter { SearchDirectory = _basePath, SearchPattern = "foo.txt", SearchOption = SearchOption.TopDirectoryOnly }; ;

            // Act
            PathSearchFilter searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 18
0
        public void PathWithLeadingDirectorySepDirectoryAndWildCardFileNameAndExtension()
        {
            // Arrange
            var path = "\\foo\\*";
            var expectedFilter = new PathSearchFilter { SearchDirectory = Path.Combine(_basePath, "foo"), SearchPattern = "*", SearchOption = SearchOption.TopDirectoryOnly };

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 19
0
        public void RootedPathWithWildCard()
        {
            // Arrange
            var path = @"x:\foo\bar\*.cs";
            var expectedFilter = new PathSearchFilter { SearchDirectory = @"x:\foo\bar", SearchPattern = @"*.cs", SearchOption = SearchOption.TopDirectoryOnly }; ;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(@"C:\project-files", path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }
Ejemplo n.º 20
0
 private void AssertEqual(PathSearchFilter expected, PathSearchFilter actual)
 {
     Assert.AreEqual(expected.SearchDirectory, actual.SearchDirectory);
     Assert.AreEqual(expected.SearchOption, actual.SearchOption);
     Assert.AreEqual(expected.SearchPattern, actual.SearchPattern);
 }
Ejemplo n.º 21
0
 private void AssertEqual(PathSearchFilter expected, PathSearchFilter actual)
 {
     Assert.AreEqual(expected.SearchDirectory, actual.SearchDirectory);
     Assert.AreEqual(expected.SearchOption, actual.SearchOption);
     Assert.AreEqual(expected.SearchPattern, actual.SearchPattern);
 }
Ejemplo n.º 22
0
        public void PathWithInvalidRecursiveWildCardSearch()
        {
            // Arrange
            var path = @"**foo\bar";
            var expectedFilter = new PathSearchFilter { SearchDirectory = _basePath, SearchPattern = @"foo\bar", SearchOption = SearchOption.AllDirectories }; ;

            // Act
            var searchFilter = PathResolver.ResolveSearchFilter(_basePath, path);

            // Assert
            AssertEqual(expectedFilter, searchFilter);
        }