Merge pull request 133 from dev/164-GetComputerName-cherry into develop

This commit is contained in:
Andy Schwartzmeyer 2015-08-28 21:47:39 +00:00
commit 60a1772a43
2 changed files with 26 additions and 1 deletions

@ -1 +1 @@
Subproject commit 44427ec1f38f443a8b90a48e50a4d40beed0fa05
Subproject commit 8e014f44d72765f086fe516e870602d5a476076e

View file

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