public void MockDirectoryInfo_EnumerateFileSystemInfos_ShouldReturnBothDirectoriesAndFiles() { var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { XFS.Path(@"c:\temp\folder\file.txt"), new MockFileData("Hello World") }, { XFS.Path(@"c:\temp\folder\folder"), new MockDirectoryData() } }); var directoryInfo = new MockDirectoryInfo(fileSystem, XFS.Path(@"c:\temp\folder")); var result = directoryInfo.EnumerateFileSystemInfos().ToArray(); Assert.That(result.Length, Is.EqualTo(2)); }
public void MockDirectoryInfo_EnumerateFileSystemInfos_ShouldReturnDirectoriesAndNamesWithSearchPatternRecursive() { var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { XFS.Path(@"c:\temp\folder\file.txt"), new MockFileData("") }, { XFS.Path(@"c:\temp\folder\folder"), new MockDirectoryData() }, { XFS.Path(@"c:\temp\folder\older"), new MockDirectoryData() } }); var directoryInfo = new MockDirectoryInfo(fileSystem, XFS.Path(@"c:\")); var result = directoryInfo.EnumerateFileSystemInfos("*", SearchOption.AllDirectories).ToArray(); Assert.That(result.Length, Is.EqualTo(5)); }
public void MockDirectoryInfo_EnumerateFileSystemInfos_ShouldReturnDirectoriesAndNamesWithSearchPattern() { MockFileSystem fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { XFS.Path(@"c:\temp\folder\file.txt"), new MockFileData("Hello World") }, { XFS.Path(@"c:\temp\folder\folder"), new MockDirectoryData() }, { XFS.Path(@"c:\temp\folder\older"), new MockDirectoryData() } }); MockDirectoryInfo directoryInfo = new MockDirectoryInfo(fileSystem, XFS.Path(@"c:\temp\folder")); FileSystemInfoBase[] result = directoryInfo.EnumerateFileSystemInfos("f*", SearchOption.AllDirectories).ToArray(); Assert.Equal(result.Length, 2); }
public void MockDirectoryInfo_EnumerateFileSystemInfos_ShouldReturnBothDirectoriesAndFiles() { var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData> { { XFS.Path(@"c:\temp\folder\file.txt"), new MockFileData("Hello World") }, { XFS.Path(@"c:\temp\folder\folder"), new MockDirectoryData() } }); var directoryInfo = new MockDirectoryInfo(fileSystem, XFS.Path(@"c:\temp\folder")); var result = directoryInfo.EnumerateFileSystemInfos().ToArray(); Assert.That(result.Length, Is.EqualTo(2)); }