You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The default temp directory, which is created automatically, is not the same as used by the MockDirectory.CreateTempSubdirectory() method.
To Reproduce
Steps to reproduce the behavior:
var fileSystem = new MockFileSystem();
var result = fileSystem.Directory.CreateTempSubdirectory();
var temp = fileSystem.Path.GetTempPath();
result.FullName.StartsWith(temp); // expected true but false
Expected behavior
It's expected that there's a single temp directory in the mocked file system but MockDirectory.CreateTempSubdirectory() uses the current user's temp path instead.
Additional context
Also there's no way to specify the temp directory manually.
Activity
vbreuss commentedon Jun 21, 2024
Thanks for reporting, @montoner0, but I couldn't reproduce this issue. I executed the following test and it was successful:
montoner0 commentedon Jun 21, 2024
@vbreuss
I believe you have to assert the result of the last line to fail the test.
Assert.That(result.FullName.StartsWith(temp));Add failing test for #1125
vbreuss commentedon Jun 22, 2024
Sorry, @montoner0, my bad 🙈
I created a pull request, that should fix your issue and will be published shortly.
Thanks for reporting!
github-actions commentedon Jun 22, 2024
This is addressed in release v21.0.22.