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); }
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); }
public void 加入空的目錄接受條件_應該拋出例外() { Assert.Throws <InvalidDirectoryFilterException>(() => { var filter = new SearchFilter(); filter.IncludeDirectory(string.Empty); }); }
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); }