Merge pull request 247 from dev/isexecutable into develop
New xunit tests for domainname and isexecutable
This commit is contained in:
commit
8a7eef57b6
|
@ -1 +1 @@
|
|||
Subproject commit 0bbda079b92fbd071f0c7ef533eac87653a6a410
|
||||
Subproject commit f6bd69cc07c0d564379c684654a3c37b0fbfdaad
|
|
@ -1 +1 @@
|
|||
Subproject commit 9bb5b7e52c3f1a18cac367c7fb7579406c6786fc
|
||||
Subproject commit 102f6163a17afec6e27107ec0fdfec5fd458c706
|
|
@ -88,8 +88,6 @@ namespace PSTests
|
|||
// It should be the same as what our platform code returns
|
||||
Assert.Equal(hostname, Platform.NonWindowsGetMachineName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -113,8 +111,47 @@ namespace PSTests
|
|||
// It should be the same as what our platform code returns
|
||||
Assert.Equal(hostname, Platform.NonWindowsGetHostName());
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void TestGetDomainName()
|
||||
{
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = @"/usr/bin/env",
|
||||
Arguments = "dnsdomainname",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false
|
||||
};
|
||||
using (Process process = Process.Start(startInfo))
|
||||
{
|
||||
// Get output of call to hostname without trailing newline
|
||||
string domainName = process.StandardOutput.ReadToEnd().Trim();
|
||||
process.WaitForExit();
|
||||
|
||||
// The process should return an exit code of 0 on success
|
||||
Assert.Equal(0, process.ExitCode);
|
||||
// It should be the same as what our platform code returns
|
||||
Assert.Equal(domainName, Platform.NonWindowsGetDomainName());
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void TestIsExecutable()
|
||||
{
|
||||
Assert.True(Platform.NonWindowsIsExecutable("/bin/ls"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void TestIsNotExecutable()
|
||||
{
|
||||
Assert.False(Platform.NonWindowsIsExecutable("/etc/hosts"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void TestDirectoryIsNotExecutable()
|
||||
{
|
||||
Assert.False(Platform.NonWindowsIsExecutable("/etc"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Reference in a new issue