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
{{ message }}
Repository navigation
File.Exists throws an ArgumentException when empty string paths are used #810
Describe the bug
MockFileSystem throws an System.ArgumentException ("The path is not of a legal form") when a empty string is passed to the File.Exists() method.
[Test]
public void MockFile_Exists_ShouldReturnFalseForEmptyString()
{
// Arrange
var fileSystem = new MockFileSystem();
// Act
var result = fileSystem.File.Exists(string.Empty);
// Assert
Assert.IsFalse(result);
}
Expected behavior
fileSystem.File.Exists() should return false and behave like System.IO.File.Exists()
Activity
fgreinacher commentedon Feb 10, 2022
Thanks for reporting!
Seems we don't respect https://docs.microsoft.com/en-us/dotnet/api/system.io.file.exists?view=net-6.0#remarks.
PR welcome 😀
github-actions commentedon Feb 17, 2022
This is addressed in release v16.1.11.
fix: make MockFile.Exists handle empty string (TestableIO#811)