Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prefix bug in MockDirectory.EnumerateDirectories (#815) #1046

Merged
merged 8 commits into from
Dec 5, 2023
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")]
Phoenox marked this conversation as resolved.
Show resolved Hide resolved
[TestCase("Folder/", "Folder/SubFolder")]
Phoenox marked this conversation as resolved.
Show resolved Hide resolved
[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