MSTestExtensions/FileAssert.cs
/// <summary>
/// Asserts that a file or directory does not exist.
/// </summary>
/// <param name="assert"><see cref="Assert.That"/></param>
/// <param name="path">The path to the file or directory.</param>
Asserts that a file or directory does not exist.
Asserts that a file or directory does not exist .
public static void FileOrDirectoryDoesNotExist(this Assert assert, string path)
        {
            Assert.IsFalse(string.IsNullOrEmpty(path), "Attempted to assert null or empty path does not exist.");
            var file = new FileInfo(path);
            if (file.Exists)
            {
                throw new AssertFailedException($"File or directory \"{path}\" exists.");
            }
            var directory = new DirectoryInfo(path);
            if (!directory.Exists)
            {
                throw new AssertFailedException($"File or directory \"{path}\" exists.");
            }
        }
public static void FileOrDirectoryDoesNotExist ( this Assert assert , string path ) { Assert . IsFalse ( string . IsNullOrEmpty ( path ) , " " ) ; var file = new FileInfo ( path ) ; if ( file . Exists ) { throw new AssertFailedException ( $" File or directory  \" { path } \"  exists. " ) ; } var directory = new DirectoryInfo ( path ) ; if ( ! directory . Exists ) { throw new AssertFailedException ( $" File or directory  \" { path } \"  exists. " ) ; } }
Asserts that a file or directory does not exist.
Asserts that a file or directory does not exist .
Assert
this
path
string
The path to the file or directory.
The path to the file or directory .
assert
None