private void ValidateGeneratedArtifacts(string generateScriptPath, string errorMessage) { string powershellArgs = $"-File {generateScriptPath} -Validate"; (Process Process, string StdOut, string StdErr)executeResult; // Support both execution within Windows 10, Nano Server and Linux environments. try { executeResult = ExecuteHelper.ExecuteProcess("pwsh", powershellArgs, OutputHelper); } catch (Win32Exception) { executeResult = ExecuteHelper.ExecuteProcess("powershell", powershellArgs, OutputHelper); } if (executeResult.Process.ExitCode != 0) { OutputHelper.WriteLine(errorMessage); } Assert.Equal(0, executeResult.Process.ExitCode); }