public void TestFilterBackupSource() { var source = new TestBackupSource(); var filteredSource = new FilterBackupSource(source, item => item.RelativePath.StartsWith("./testdir1")); foreach (var backupSourceFile in filteredSource.EnumerateFiles()) { Assert.IsTrue(backupSourceFile.RelativePath.StartsWith("./testdir1")); } }
public void TestFilterBackupDoesNotHandleFilterException() { var source = new TestBackupSource(); var filteredSource = new FilterBackupSource(source, item => { throw new InvalidDataException(); }); // ReSharper disable ReturnValueOfPureMethodIsNotUsed Assert.Throws<InvalidDataException>(() => filteredSource.EnumerateFiles ().ToArray ()); // ReSharper restore ReturnValueOfPureMethodIsNotUsed }