public void TestAllFilesAndFolders() { int files = 0, folders = 0, total = 0; string dir = TestFolder; FindFile.AllFilesIn(dir, e => { Assert.IsTrue(File.Exists(e.FullPath)); files++; }); FindFile.AllFoldersIn(dir, e => { Assert.IsTrue(Directory.Exists(e.FullPath)); folders++; }); FindFile.AllFilesAndFoldersIn(dir, e => { Assert.IsTrue(File.Exists(e.FullPath) || Directory.Exists(e.FullPath)); total++; }); Assert.AreEqual(6, files); Assert.AreEqual(2, folders); Assert.AreEqual(8, total); }
public void TestCancel() { int total = 0; FindFile.AllFilesAndFoldersIn(TestFolder, e => { Assert.IsTrue(File.Exists(e.FullPath)); total++; e.CancelEnumeration = true; }); Assert.AreEqual(1, total); }