Library/Library.Test/TestFindFile.cs
C# | Copy Code |
---|---|
FindFile ff = new FindFile(); Assert.AreEqual("", ff.BaseDirectory); Assert.AreEqual("*", ff.FilePattern); Assert.AreEqual(true, ff.Recursive); Assert.AreEqual(true, ff.IncludeFiles); Assert.AreEqual(true, ff.IncludeFolders); Assert.AreEqual(false, ff.RaiseOnAccessDenied); Assert.AreEqual(4096, ff.MaxPath); Assert.AreEqual(TestFolder, ff.BaseDirectory = TestFolder); Assert.AreEqual("a.*", ff.FilePattern = "a.*"); Assert.AreEqual(false, ff.Recursive = false); Assert.AreEqual(false, ff.IncludeFiles = false); Assert.AreEqual(false, ff.IncludeFolders = false); Assert.AreEqual(true, ff.RaiseOnAccessDenied = true); Assert.AreEqual(1024, ff.MaxPath = 1024); ff.FileFound += (o, e) => Assert.Fail("Should not find anything."); ff.Find(); |
VB.NET | Copy Code |
---|---|
Dim ff As New FindFile() Assert.AreEqual("", ff.BaseDirectory) Assert.AreEqual("*", ff.FilePattern) Assert.AreEqual(True, ff.Recursive) Assert.AreEqual(True, ff.IncludeFiles) Assert.AreEqual(True, ff.IncludeFolders) Assert.AreEqual(False, ff.RaiseOnAccessDenied) Assert.AreEqual(4096, ff.MaxPath) Assert.AreEqual(TestFolder, ff.BaseDirectory = TestFolder) Assert.AreEqual("a.*", ff.FilePattern = "a.*") Assert.AreEqual(False, ff.Recursive = False) Assert.AreEqual(False, ff.IncludeFiles = False) Assert.AreEqual(False, ff.IncludeFolders = False) Assert.AreEqual(True, ff.RaiseOnAccessDenied = True) Assert.AreEqual(1024, ff.MaxPath = 1024) ff.FileFound += Function(o, e) Assert.Fail("Should not find anything.") ff.Find() |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7