Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/System.IO.Abstractions.TestingHelpers/MockFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ public override bool Exists(string path)
return false;
}

if (path.Length == 0)
{
return false;
}

var file = mockFileDataAccessor.GetFile(path);
return file != null && !file.IsDirectory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ public void MockFile_Exists_ShouldReturnFalseForNullPath()
Assert.IsFalse(result);
}

[Test]
public void MockFile_Exists_ShouldReturnFalseForEmptyStringPath()
{
// Arrange
var fileSystem = new MockFileSystem();

// Act
var result = fileSystem.File.Exists(string.Empty);

// Assert
Assert.IsFalse(result);
}

[Test]
public void MockFile_Exists_ShouldReturnFalseForDirectories()
{
Expand Down