The DirectoryAssert class provides methods for making asserts about file system directories, which may be provided as DirectoryInfos or as strings giving the path to each directory.
DirectoryAssert.AreEqual() and DirectoryAssert.AreNotEqual() compare two directories for equality. Directories are considered equal if they have the same FullName, Attributes, CreationTime and LastAccessTime.
Note: Two different directories containing the same files are not considered to be equal.
DirectoryAssert.AreEqual( DirectoryInfo expected, DirectoryInfo actual ); DirectoryAssert.AreEqual( DirectoryInfo expected, DirectoryInfo actual, string message ); DirectoryAssert.AreEqual( DirectoryInfo expected, DirectoryInfo actual, string message, params object[] args ); DirectoryAssert.AreEqual( string expected, string actual ); DirectoryAssert.AreEqual( string expected, string actual, string message ); DirectoryAssert.AreEqual( string expected, string actual, string message, params object[] args ); DirectoryAssert.AreNotEqual( DirectoryInfo expected, DirectoryInfo actual ); DirectoryAssert.AreNotEqual( DirectoryInfo expected, DirectoryInfo actual, string message ); DirectoryAssert.AreNotEqual( DirectoryInfo expected, DirectoryInfo actual, string message, params object[] args ); DirectoryAssert.AreNotEqual( string expected, string actual ); DirectoryAssert.AreNotEqual( string expected, string actual, string message ); DirectoryAssert.AreNotEqual( string expected, string actual, string message, params object[] args );
DirectoryAssert.IsEmpty() and DirectoryAssert.IsNotEmpty() test whether the specified directory is empty.
DirectoryAssert.IsEmpty( DirectoryInfo directory ); DirectoryAssert.IsEmpty( DirectoryInfo directory, string message ); DirectoryAssert.IsEmpty( DirectoryInfo directory, string message, params object[] args ); DirectoryAssert.IsEmpty( string directory ); DirectoryAssert.IsEmpty( string directory, string message ); DirectoryAssert.IsEmpty( string directory, string message, params object[] args ); DirectoryAssert.IsNotEmpty( DirectoryInfo directory ); DirectoryAssert.IsNotEmpty( DirectoryInfo directory, string message ); DirectoryAssert.IsNotEmpty( DirectoryInfo directory, string message, params object[] args ); DirectoryAssert.IsNotEmpty( string directory ); DirectoryAssert.IsNotEmpty( string directory, string message ); DirectoryAssert.IsNotEmpty( string directory, string message, params object[] args );
DirectoryAssert.IsWithin() and DirectoryAssert.IsNotWithin() test whether the second directory is a direct or indirect subdirectory of the first directory.
DirectoryAssert.IsWithin( DirectoryInfo expected, DirectoryInfo actual ); DirectoryAssert.IsWithin( DirectoryInfo expected, DirectoryInfo actual, string message ); DirectoryAssert.IsWithin( DirectoryInfo expected, DirectoryInfo actual, string message, params object[] args ); DirectoryAssert.IsWithin( string expected, string actual ); DirectoryAssert.IsWithin( string expected, string actual, string message ); DirectoryAssert.IsWithin( string expected, string actual, string message, params object[] args ); DirectoryAssert.IsNotWithin( DirectoryInfo expected, DirectoryInfo actual ); DirectoryAssert.IsNotWithin( DirectoryInfo expected, DirectoryInfo actual, string message ); DirectoryAssert.IsNotWithin( DirectoryInfo expected, DirectoryInfo actual, string message, params object[] args ); DirectoryAssert.IsNotWithin( string expected, string actual ); DirectoryAssert.IsNotWithin( string expected, string actual, string message ); DirectoryAssert.IsNotWithin( string expected, string actual, string message, params object[] args );