Describe the bug
When you call DirectoryInfo.Name, the result is an empty string for a root path in the mocked version. The real file system returns "C:\".
To Reproduce
I'm using version 13.2.10 and the TestingHelpers project from NuGet. These unit tests succeed, which should not happen:
[Test]
public void DirectoryName_DifferentForRoot()
{
var mock = new MockFileSystem();
var real = new FileSystem();
var nameInMock = mock.DirectoryInfo.FromDirectoryName("C:\\").Name;
var nameInReal = real.DirectoryInfo.FromDirectoryName("C:\\").Name;
Assert.AreEqual("", nameInMock);
Assert.AreEqual("C:\\", nameInReal);
}
[Test]
public void DirectoryName_IdenticalForFile()
{
var mock = new MockFileSystem();
var real = new FileSystem();
var nameInMock = mock.DirectoryInfo.FromDirectoryName("C:\\test.sldprt").Name;
var nameInReal = real.DirectoryInfo.FromDirectoryName("C:\\test.sldprt").Name;
Assert.AreEqual("test.sldprt", nameInMock);
Assert.AreEqual("test.sldprt", nameInReal);
}
Expected behavior
I'd expect the directory name to always be the same for mocked and real file systems.
Additional context
Link to the docs: https://docs.microsoft.com/en-us/dotnet/api/system.io.directoryinfo.name?view=net-5.0
Describe the bug
When you call DirectoryInfo.Name, the result is an empty string for a root path in the mocked version. The real file system returns "C:\".
To Reproduce
I'm using version 13.2.10 and the TestingHelpers project from NuGet. These unit tests succeed, which should not happen:
Expected behavior
I'd expect the directory name to always be the same for mocked and real file systems.
Additional context
Link to the docs: https://docs.microsoft.com/en-us/dotnet/api/system.io.directoryinfo.name?view=net-5.0