예제 #1
0
        public void 分次加入目錄條件_符合條件的目錄應該被接受()
        {
            // Arrange
            var filter = new SearchFilter();

            filter.IncludeDirectory(@"C:\contents");
            filter.IncludeDirectory(@"C:\doc");
            filter.IncludeDirectory(@"C:\scripts");

            // Act
            var result = filter.Match(new[] { @"C:\contents\test.dat" });

            // Assert
            Assert.That(result, Is.Not.Empty);
        }
예제 #2
0
        public void 分次加入目錄條件_不符合條件的目錄應該不接受()
        {
            // Arrange
            var filter = new SearchFilter();

            filter.IncludeDirectory(DirectoryTestCases.目錄列表[0]);
            filter.IncludeDirectory(DirectoryTestCases.目錄列表[1]);
            filter.IncludeDirectory(DirectoryTestCases.目錄列表[2]);

            // Act
            var result = filter.Match(new[] { "bin" });

            // Assert
            Assert.That(result, Is.Empty);
        }
예제 #3
0
 public void 加入空的目錄接受條件_應該拋出例外()
 {
     Assert.Throws <InvalidDirectoryFilterException>(() =>
     {
         var filter = new SearchFilter();
         filter.IncludeDirectory(string.Empty);
     });
 }
예제 #4
0
        public void 目錄先加入接受條件再加入排除條件_符合條件的目錄應該不被接受()
        {
            // Arrange
            var filter = new SearchFilter();

            filter.IncludeDirectory(@"C:\contents");
            filter.ExcludeDirectory(@"C:\contents");

            // Act
            var result = filter.Match(new[] { @"C:\contents\test.dat" });

            // Assert
            Assert.That(result, Is.Empty);
        }