-
Notifications
You must be signed in to change notification settings - Fork 263
IDirectoryInfoFactory.Wrap loses part of absolute path when used with MockFileSystem #1049
Copy link
Copy link
Closed
Labels
area: testinghelpersIssues that address the testing helpersIssues that address the testing helpersstate: ready to pickIssues that are ready for being worked onIssues that are ready for being worked onstate: releasedIssues that are releasedIssues that are releasedtype: bugIssues that describe misbehaving functionalityIssues that describe misbehaving functionality
Description
Describe the bug
If you provide the MockFileSystem's DirectoryInfo.Wrap method with a DirectoryInfo that has an absolute path, the resulting IDirectoryInfo has the wrong file path.
To Reproduce
using Xunit;
using System.IO.Abstractions;
using System.IO.Abstractions.TestingHelpers;
[Fact]
public void Test()
{
var fs = new MockFileSystem();
var directoryInfo = new DirectoryInfo(@"C:\subfolder\file");
var wrappedDirectoryInfo = fs.DirectoryInfo.Wrap(directoryInfo);
Assert.Equal(directoryInfo.FullName, wrappedDirectoryInfo.FullName); // wrappedDirectoryInfo returns "C:\file"
}Expected behaviour
The test above is expected to pass.
Actual behaviour
Assert.Equal() Failure
↓ (pos 3)
Expected: C:\subfolder\file
Actual: C:\file
↑ (pos 3)
Additional context
Tested on Windows 10, .Net 7, System.IO.Abstractions version 19.2.69
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: testinghelpersIssues that address the testing helpersIssues that address the testing helpersstate: ready to pickIssues that are ready for being worked onIssues that are ready for being worked onstate: releasedIssues that are releasedIssues that are releasedtype: bugIssues that describe misbehaving functionalityIssues that describe misbehaving functionality