Skip to content

Commit

Permalink
Add a test that demonstrates the prefix logic of `MockDirectory.Enume…
Browse files Browse the repository at this point in the history
…rateDirectories`
  • Loading branch information
Phoenox committed Oct 20, 2023
1 parent 5cfe8e3 commit 185f7fd
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,22 @@ public void MockDirectory_EnumerateDirectories_ShouldThrowWhenPathIsNotMocked()
// Assert
Assert.Throws<DirectoryNotFoundException>(action);
}


[TestCase("Folder", "Folder/SubFolder")]
[TestCase("/Folder", "/Folder/SubFolder")]
[TestCase("Folder/", "Folder/SubFolder")]
[TestCase("Folder/.././Folder", "Folder/.././Folder/SubFolder")]
public void MockDirectory_EnumerateDirectories_ShouldReturnPathsPrefixedWithQueryPath(
string queryPath, string expectedPath)
{
var fileSystem = new MockFileSystem();
fileSystem.Directory.CreateDirectory("Folder/SubFolder");

var actualResult = fileSystem.Directory.EnumerateDirectories(queryPath);

CollectionAssert.AreEqual(new[] { expectedPath }, actualResult);
}

public static IEnumerable<object[]> GetPathsForMoving()
{
Expand Down

0 comments on commit 185f7fd

Please sign in to comment.