What I'm trying to achieve: I want to use a web application to run all the tests on my local windows PC.
I am using the following command:
c:/code/myRepo && dotnet test
I have tried the following command through run:
cmd.exe /C "c:/code/myRepo && dotnet test"
which runs successfully and all my tests pass.
I now want to run this from my .net Core application as so:
public static string RunCommand( string cmd)
{
var escapedArgs = cmd.Replace("\"", "\\\"");
var process = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = $"/C \"{escapedArgs}\"",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = false,
}
};
process.Start();
string result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return result;
}
When I run the tests from here the tests run, but they all fail.
Question: there is something different between these 2 environments but I have no idea what, how /what can I check what might be different. I've tried the command:
set
and can't see anything obviously affecting the environment