Skip to content

Commit 76d9a2b

Browse files
schibu007Samuel Bernhard
and
Samuel Bernhard
authored
Optimizes performance of MockDirectory.Exists (#704)
Co-authored-by: Samuel Bernhard <[email protected]>
1 parent a4d6a08 commit 76d9a2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
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)