1
Vote

Directory.GetFiles should throw exception for missing directories

description

    [Test]
    public void GivenMockFilesystem_GetFilesOnAMissingFolderShouldThrowException()
    {
        var filesys = new MockFileSystem(new Dictionary<string, MockFileData>(), @"c:\");

        Assert.Throws<DirectoryNotFoundException>(() => filesys.Directory.GetFiles(@"c:\AMissingFolder"));
    }

    [Test]
    public void GivenFilesystem_GetFilesOnAMissingFolderShouldThrowException()
    {
        Assert.Throws<DirectoryNotFoundException>(() => Directory.GetFiles(@"c:\AMissingFolder"));
    }
The former (using IO.Abstractions) fails and the latter passes.

comments