Unit testing file system operations

I'm looking at how to unit test file system operations that does not interact with the physical file system (not an integration test).

Test Suite
                  [TestFixture]
public class DataDumperTest
{
    [Test]
    public void Should_dump_string_to_file()
    {
        var expectedString = "hello"
        var dumper = new DataDumper();

        dumper.WriteString(expectedString);

        var fileSystem = new FileSystem()
        var actualString = fileSystem.File.ReadAllText("c:\\dump.txt");

        Expect(expectedString, actualString);
    }

}
                
shawnmclean
Language:

1 Suggestion

1

shawnmclean
Language: