private static Process RunInChess(MethodBase methodInfo, ChessOptions options) { string extraArguments = string.Format(" /arg:{0} /arg:{1}", methodInfo.DeclaringType, methodInfo.Name); string testAssemblyName = new AssemblyName(Assembly.GetExecutingAssembly().FullName).Name; string testClassName = typeof (ChessTest).FullName; string domainAssemblyName = new AssemblyName(typeof (IAccount).Assembly.FullName).Name; string chessCommandLine = string.Format("{0}.dll /testclass:{1} /ia:{2} /detectraces", testAssemblyName, testClassName, domainAssemblyName); if (options.Debug) { chessCommandLine += " /break:s"; } if(options.Repro) { chessCommandLine += " /repro"; } if(options.Trace) { chessCommandLine += " /trace"; } if(!File.Exists(@"Concurrency\chess\mchess.exe")) { NUnit.Framework.Assert.Ignore("Chess.exe is not present in Libs folder. Test will not run. Upload chess from http://research.microsoft.com/en-us/projects/chess/download.aspx"); } var chessProcess = Process.Start(new ProcessStartInfo(@"Concurrency\chess\mchess.exe", chessCommandLine + extraArguments) { CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true }); return chessProcess; }
private static void Run(MethodBase methodInfo, ChessOptions options) { Process chessProcess = RunInChess(methodInfo, options); chessProcess.WaitForExit(); DumpOutput(chessProcess, Console.Out); string errorCode = GetErrorCode(); if (errorCode != "0") { if (File.Exists(ERROR_FILE_NAME)) { Console.WriteLine(File.ReadAllText(ERROR_FILE_NAME)); } NUnit.Framework.Assert.Fail("Chess return error code {0}", errorCode); } }
private static Process RunInChess(MethodBase methodInfo, ChessOptions options) { string extraArguments = string.Format(" /arg:{0} /arg:{1}", methodInfo.DeclaringType, methodInfo.Name); string testAssemblyName = new AssemblyName(Assembly.GetExecutingAssembly().FullName).Name; string testClassName = typeof(ChessTest).FullName; string domainAssemblyName = new AssemblyName(typeof(IAccount).Assembly.FullName).Name; string chessCommandLine = string.Format("{0}.dll /testclass:{1} /ia:{2} /detectraces", testAssemblyName, testClassName, domainAssemblyName); if (options.Debug) { chessCommandLine += " /break:s"; } if (options.Repro) { chessCommandLine += " /repro"; } if (options.Trace) { chessCommandLine += " /trace"; } if (!File.Exists(@"Concurrency\chess\mchess.exe")) { NUnit.Framework.Assert.Ignore("Chess.exe is not present in Libs folder. Test will not run. Upload chess from http://research.microsoft.com/en-us/projects/chess/download.aspx"); } var chessProcess = Process.Start(new ProcessStartInfo(@"Concurrency\chess\mchess.exe", chessCommandLine + extraArguments) { CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true }); return(chessProcess); }
public static void RunRemotely(Expression<Action> test, ChessOptions options = new ChessOptions()) { var m = (MethodCallExpression)test.Body; Run(m.Method, options); }
public static void RunRemotely(Expression <Action> test, ChessOptions options = new ChessOptions()) { var m = (MethodCallExpression)test.Body; Run(m.Method, options); }