Merge pull request 133 from dev/164-GetComputerName-cherry into develop
This commit is contained in:
commit
60a1772a43
|
@ -1 +1 @@
|
|||
Subproject commit 44427ec1f38f443a8b90a48e50a4d40beed0fa05
|
||||
Subproject commit 8e014f44d72765f086fe516e870602d5a476076e
|
|
@ -65,5 +65,30 @@ namespace PSTests
|
|||
Assert.Equal(username, Platform.NonWindowsGetUserName());
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void TestGetMachineName()
|
||||
{
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = @"/usr/bin/env",
|
||||
Arguments = "hostname",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false
|
||||
};
|
||||
using (Process process = Process.Start(startInfo))
|
||||
{
|
||||
// Get output of call to hostname without trailing newline
|
||||
string hostname = 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(hostname, Platform.NonWindowsGetMachineName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue