コード例 #1
0
 public void FindFirstFileNoFiles()
 {
     using (var find = FileMethods.CreateFindOperation(FileMethods.GetTempPath() + System.IO.Path.GetRandomFileName()))
     {
         find.GetNextResult().Should().BeNull();
     }
 }
コード例 #2
0
        public void FindFileEmptyFolder(string pattern)
        {
            using (var temp = new TestFileCleaner())
            {
                string subdir = Paths.Combine(temp.TempFolder, "Subdir");
                DirectoryMethods.CreateDirectory(subdir);

                FileMethods.CreateFindOperation(subdir, nameFilter: pattern,
                                                findTransform: FindTransforms.ToFileName.Instance, findFilter: FindFilters.All.Instance)
                .Should().Contain(new string[] { ".", ".." });
            }
        }
コード例 #3
0
        public void FindFileEmptyFolder()
        {
            using (var temp = new TestFileCleaner())
            {
                string subdir = System.IO.Path.Combine(temp.TempFolder, "Subdir");
                DirectoryMethods.CreateDirectory(subdir);

                using (var find = FileMethods.CreateFindOperation(subdir + @"\*"))
                {
                    var foundFile = find.GetNextResult();
                    foundFile.Should().NotBeNull();
                    foundFile.FileName.Should().Be(".");
                    foundFile = find.GetNextResult();
                    foundFile.Should().NotBeNull();
                    foundFile.FileName.Should().Be("..");
                    foundFile = find.GetNextResult();
                    foundFile.Should().BeNull();
                }
            }
        }
コード例 #4
0
 public void FindFirstFileHandlesRoots(string path)
 {
     FileMethods.CreateFindOperation <string>(path).Should().NotBeEmpty();
     FileMethods.CreateFindOperation <string>(path, null).Should().NotBeEmpty();
 }
コード例 #5
0
 public void FindFirstFileNoFiles()
 {
     FileMethods.CreateFindOperation <string>(FileMethods.GetTempPath(), nameFilter: System.IO.Path.GetRandomFileName())
     .Should().BeEmpty();
 }