1 write to _dirInfo
Microsoft.NET.TestFramework (1)
Assertions\DirectoryInfoAssertions.cs (1)
12_dirInfo = dir;
31 references to _dirInfo
Microsoft.NET.TestFramework (31)
Assertions\DirectoryInfoAssertions.cs (31)
15public DirectoryInfo DirectoryInfo => _dirInfo; 19_dirInfo.Exists.Should().BeTrue($"Expected directory {_dirInfo.FullName} to exist, but it does not."); 25_dirInfo.Exists.Should().BeFalse($"Expected directory {_dirInfo.FullName} to not exist, but it does."); 31var file = _dirInfo.EnumerateFiles(expectedFile, SearchOption.TopDirectoryOnly).SingleOrDefault() ?? new FileInfo(Path.Combine(_dirInfo.FullName, expectedFile)); 32file.Should().Exist($"Expected File {expectedFile} cannot be found in directory {_dirInfo.FullName}."); 38var file = _dirInfo.EnumerateFiles(expectedFile, SearchOption.TopDirectoryOnly).SingleOrDefault() ?? new FileInfo(Path.Combine(_dirInfo.FullName, expectedFile)); 39file.Should().NotExist($"File {expectedFile} should not be found in directory {_dirInfo.FullName}."); 59var matchingFileExists = _dirInfo.EnumerateFiles(expectedFilesSearchPattern, searchOption).Any(); 61matchingFileExists.Should().BeTrue($"Expected directory {_dirInfo.FullName} to contain files matching {expectedFilesSearchPattern}, but no matching file exists."); 78var matchingFileCount = _dirInfo.EnumerateFiles(expectedFilesSearchPattern, searchOption).Count(); 79matchingFileCount.Should().Be(0, $"Found {matchingFileCount} files that should not exist in directory {_dirInfo.FullName}. No file matching {expectedFilesSearchPattern} should exist."); 86var dir = _dirInfo.EnumerateDirectories(expectedDir, SearchOption.TopDirectoryOnly).SingleOrDefault() ?? new DirectoryInfo(expectedDir); 87dir.Exists.Should().BeTrue($"Expected directory {expectedDir} cannot be found inside directory {_dirInfo.FullName}."); 94var actualFiles = _dirInfo.EnumerateFiles("*", searchOption) 95.Select(f => f.FullName.Substring(_dirInfo.FullName.Length + 1) // make relative to _dirInfo 102missingFiles.Should().BeEmpty($"Following files cannot be found inside directory {_dirInfo.FullName} {nl} {string.Join(nl, missingFiles)}"); 103extraFiles.Should().BeEmpty($"Following extra files are found inside directory {_dirInfo.FullName} {nl} {string.Join(nl, extraFiles)}"); 110_dirInfo.EnumerateFileSystemInfos().Any().Should().BeFalse($"The directory {_dirInfo.FullName} is not empty."); 117_dirInfo.EnumerateFileSystemInfos().Any().Should().BeTrue($"The directory {_dirInfo.FullName} is empty."); 124_dirInfo.Exists.Should().BeFalse($"Expected directory {_dirInfo.FullName} to not exist, but it does."); 133var subDirectories = _dirInfo.EnumerateDirectories(); 138subDirectories.Any().Should().BeFalse($"Directory {_dirInfo.FullName} should not have any sub directories."); 143.Select(f => f.FullName.Substring(_dirInfo.FullName.Length + 1) // make relative to _dirInfo 149errorSubDirectories.Should().BeEmpty($"The following subdirectories should not be found inside directory {_dirInfo.FullName} {nl} {string.Join(nl, errorSubDirectories)}");