Skip to content

Commit 9d716b7

Browse files
author
Jens Weiermann
committed
Updated test to (hopfully) also work on linux machines
1 parent 992c3a8 commit 9d716b7

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

System.IO.Abstractions.TestingHelpers.Tests/DirectoryInfoTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ public void Parent_ForRootDirectory_ShouldReturnNull()
1313
{
1414
var wrapperFilesystem = new FileSystem();
1515

16-
var directoryInfo = wrapperFilesystem.DirectoryInfo.FromDirectoryName("C:\\");
17-
var rootsParent = directoryInfo.Parent;
16+
var current = wrapperFilesystem.Directory.GetCurrentDirectory();
17+
var root = wrapperFilesystem.DirectoryInfo.FromDirectoryName(current).Root;
18+
var rootsParent = root.Parent;
1819
Assert.IsNull(rootsParent);
1920
}
2021
}

System.IO.Abstractions/DirectoryInfoWrapper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,13 @@ public override DirectoryInfoBase Parent
230230
get
231231
{
232232
if (instance.Parent == null)
233+
{
233234
return null;
235+
}
234236
else
237+
{
235238
return new DirectoryInfoWrapper(FileSystem, instance.Parent);
239+
}
236240
}
237241
}
238242

0 commit comments

Comments
 (0)