added fail under directory as input unit test

This commit is contained in:
Zachary Folwick 2015-09-02 11:02:09 -07:00
parent 73b1a71420
commit 080c734dfb

View file

@ -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));
}
}