Skip to content

zach-delong/FluentAssertions.FileSystem

Repository files navigation

FluentAssertions.FileSystem

This is a small extension for the popular FluentAssertions library that provides some simple assertions for use with the MockFileSystem type provided by System.IO.Abstractions project.

This package provides a new namespace FluentAssertions.FileSystem that provides an extension method .Should() on the MockFilesystem type provided by System.IO.Abstractions.

The Should method returns an assertions object that has several helpful assertions which can analyze and assert about the MockFilesystem in question.

Example

using System.IO.Abstractions.TestingHelpers;
using FluentAssertions.Filesystem;

public class ExampleUsage 
{
    public void Example()
    {
        var mockFileSystem = new MockFileSystem();

        mockFileSystem
			.AddDirectory("example_directory");

        mockFileSystem
            .Should()
			.ContainDirectory("example_directory");
    }
}

See the provided unit tests for more examples, and the comments in MockFileSystemAssertions for full details about what assertions are available and how to use them.

About

A simple package providing some easy assertions in the FluentAssertions library for the System.IO.Abstractions.TestingHelpers project

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages