This library is an extension to FluentAssertions for the IFileSystem
interface.
-
Install
Testably.Abstractions.FluentAssertions
as nuget package.dotnet add package Testably.Abstractions.FluentAssertions
-
Add the following
using
statement:using Testably.Abstractions.FluentAssertions;
This brings the extension methods in the current scope.
-
Verify, that a directory "foo" exists under the current directory in the file system:
fileSystem.Should().HaveDirectory("foo");
or
IDirectoryInfo directoryInfo = fileSystem.DirectoryInfo.New("."); directoryInfo.Should().HaveDirectory("foo");
-
Verify, that the file "foo.txt" has text content "bar":
fileSystem.Should().HaveFile("foo.txt") .Which.HasContent("bar");