Skip to content

Commit 76d9a2b

Browse files
schibu007Samuel Bernhard
andauthored
Optimizes performance of MockDirectory.Exists (#704)
Co-authored-by: Samuel Bernhard <sbernhard@hamilton.ch>
1 parent a4d6a08 commit 76d9a2b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/System.IO.Abstractions.TestingHelpers/MockDirectory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public override bool Exists(string path)
118118
{
119119
path = path.TrimSlashes();
120120
path = mockFileDataAccessor.Path.GetFullPath(path);
121-
return mockFileDataAccessor.AllDirectories.Any(p => mockFileDataAccessor.StringOperations.Equals(p, path));
121+
return mockFileDataAccessor.GetFile(path)?.IsDirectory ?? false;
122122
}
123123
catch (Exception)
124124
{

0 commit comments

Comments
 (0)