MSTestExtensions/FileAssert.cs
/// <summary>
/// Asserts that a file or directory exists.
/// </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 exists.
Asserts that a file or directory exists .
public static void FileOrDirectoryExists(this Assert assert, string path)
        {
            Assert.IsFalse(string.IsNullOrEmpty(path), "Attempted to assert null or empty path exists.");
            var file = new FileInfo(path);
            if (!file.Exists)
            {
                var directory = new DirectoryInfo(path);
                if (!directory.Exists)
                {
                    throw new AssertFailedException($"File or directory \"{path}\" does not exist.");
                }
            }
        }
public static void FileOrDirectoryExists ( this Assert assert , string path ) { Assert . IsFalse ( string . IsNullOrEmpty ( path ) , " " ) ; var file = new FileInfo ( path ) ; if ( ! file . Exists ) { var directory = new DirectoryInfo ( path ) ; if ( ! directory . Exists ) { throw new AssertFailedException ( $" File or directory  \" { path } \"  does not exist. " ) ; } } }
Asserts that a file or directory exists.
Asserts that a file or directory exists .
Assert
this
<not_specific>
path
string
The path to the file or directory.
The path to the file or directory .
assert
<not_specific>
None