-
-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
Description
Hi found a bug where "DirectoryInfoMock.Parent" return wrong parent compared to the system API. I narrow it down to the file path has ending "\" like this "C:\SomeStorage\". This problem is seen on a unittest target Net framework. Here is some sample code.
[TestMethod]
public void Test()
{
var d = new DirectoryInfo($"C:\\SomeStorage\\");
Console.WriteLine($"Filesystem parent {d.Parent.FullName}"); // this write out "C:\"
var fs = new MockFileSystem();
this.storageDirectory = this.fileSystem.DirectoryInfo.New(d.FullName);
Console.WriteLine($"Mock parent {storageDirectory.Parent.FullName}"); // this write out "C:\SomeStorage"
}
I think the problem is with
Testably.Abstractions/Source/Testably.Abstractions.Testing/Helpers/Execute.SimulatedPath.cs
Line 171 in 78b0421
public string? GetDirectoryName(string? path) |