public void FilesAreEnumerated() { using (var scenario = new DisposableFileSystem() .CreateFile("alpha.txt")) { var contents = new DirectoryInfoWrapper(scenario.DirectoryInfo).EnumerateFileSystemInfos(); var alphaTxt = contents.OfType <FileInfoBase>().Single(); Assert.Equal(1, contents.Count()); Assert.Equal("alpha.txt", alphaTxt.Name); } }
public void FoldersAreEnumerated() { using (var scenario = new DisposableFileSystem() .CreateFolder("beta")) { var contents1 = new DirectoryInfoWrapper(scenario.DirectoryInfo).EnumerateFileSystemInfos(); var beta = contents1.OfType <DirectoryInfoBase>().Single(); var contents2 = beta.EnumerateFileSystemInfos(); Assert.Equal(1, contents1.Count()); Assert.Equal("beta", beta.Name); Assert.Equal(0, contents2.Count()); } }
public void SubFoldersAreEnumerated() { using (var scenario = new DisposableFileSystem() .CreateFolder("beta") .CreateFile(Path.Combine("beta", "alpha.txt"))) { var contents1 = new DirectoryInfoWrapper(scenario.DirectoryInfo).EnumerateFileSystemInfos(); var beta = contents1.OfType <DirectoryInfoBase>().Single(); var contents2 = beta.EnumerateFileSystemInfos(); var alphaTxt = contents2.OfType <FileInfoBase>().Single(); Assert.Equal(1, contents1.Count()); Assert.Equal("beta", beta.Name); Assert.Equal(1, contents2.Count()); Assert.Equal("alpha.txt", alphaTxt.Name); } }