added fail under directory as input unit test
This commit is contained in:
parent
73b1a71420
commit
080c734dfb
1 changed files with 14 additions and 4 deletions
|
@ -93,7 +93,7 @@ namespace PSTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public static void TestIsHardLink()
|
public static void TestIsHardLinkWithFileSystemInfo()
|
||||||
{
|
{
|
||||||
// a file that should exist on every *nix distro
|
// a file that should exist on every *nix distro
|
||||||
|
|
||||||
|
@ -102,7 +102,6 @@ namespace PSTests
|
||||||
{
|
{
|
||||||
File.Create(path);
|
File.Create(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a file to write to using StreamWriter.
|
// 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.
|
// 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);
|
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(path);
|
||||||
|
@ -119,9 +118,20 @@ namespace PSTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[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));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue