diff --git a/src/ps_test/test_CorePsPlatform.cs b/src/ps_test/test_CorePsPlatform.cs index b761c234b..bc62134ca 100644 --- a/src/ps_test/test_CorePsPlatform.cs +++ b/src/ps_test/test_CorePsPlatform.cs @@ -93,7 +93,7 @@ namespace PSTests } [Fact] - public static void TestIsHardLink() + public static void TestIsHardLinkWithFileSystemInfo() { // a file that should exist on every *nix distro @@ -102,7 +102,6 @@ namespace PSTests { File.Create(path); } - // Create a file to write to using StreamWriter. // convert string to stream. On Windows, this appears to be handled, but on *nix, we apparently need to convert to UTF8. byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(path); @@ -119,9 +118,20 @@ namespace PSTests } [Fact] - public static void TestIsHardLinkFailsWithDirectory() + public static void TestIsHardLinkFailsWithDirectoryWithFileSystemInfo() { - + // A folder that should exist on every *nix system + string path = @"/tmp"; + + // Create a file to write to using StreamWriter. + // convert string to stream. On Windows, this appears to be handled, but on *nix, we apparently need to convert to UTF8. + byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(path); + MemoryStream stream = new MemoryStream(byteArray); + + // Convert `path` string to FileSystemInfo data type. And now, it should return true + FileSystemInfo fd = new FileInfo(path); + Assert.False(Platform.NonWindowsIsHardLink(fd)); + } }