Exemple #1
0
        public void MSTest_Suite_Passes()
        {
            var results = ProcessExtensions.Execute(testRunner, Quote(msTestTests));

            Assert.AreEqual(
                0, results.ExitCode,
                "TestRunner.exe returned non-zero exit code");

            Assert.IsTrue(
                results.Output.Contains(MSTest.MSTestTests.TestCleanupMessage),
                "[TestCleanup] method did not run");

            Assert.IsTrue(
                results.Output.Contains(MSTest.MSTestTests.ClassCleanupMessage),
                "[ClassCleanup] method did not run");

            Assert.IsTrue(
                results.Output.Contains(MSTest.MSTestTests.AssemblyCleanupMessage),
                "[AssemblyCleanup] method did not run");

            Assert.IsTrue(
                results.Output.Contains(MSTest.MSTestTests.TraceTestMessage),
                "System.Diagnostics.Trace test message was not printed");

            Assert.IsFalse(
                results.Output.Contains(MSTest.MSTestTests.IgnoredTestMessage),
                "An [Ignore]d test method ran");
        }
        /// <summary>
        /// Reinvoke TestRunner to run tests in a test assembly in a separate process
        /// </summary>
        static int ExecuteInNewProcess(string assemblyPath)
        {
            //
            // TODO
            // Teach how to reinvoke using mono.exe if that's how the initial invocation was done
            //
            var testRunner = Assembly.GetExecutingAssembly().Location;

            return(ProcessExtensions.Execute(testRunner, "--inproc \"" + assemblyPath + "\"").ExitCode);
        }
Exemple #3
0
        WriteDot(Target targetToBuild)
        {
            if (!Enabled)
            {
                return;
            }
            var debugDir = Graph.Workspace.GetTraceDirectory();
            var dotFile  = Path.Combine(debugDir, Invariant($"graph{DotCount:d2}.dot"));
            var pngFile  = Path.Combine(debugDir, Invariant($"graph{DotCount:d2}.dot.png"));
            var dot      =
                EnvironmentExtensions.IsWindows
            ? "C:\\Program Files (x86)\\Graphviz2.38\\bin\\dot.exe"
            : "dot";

            File.WriteAllLines(dotFile, ToDot(targetToBuild));
            ProcessExtensions.Execute(false, false, null, dot, "-Tpng", "-o" + pngFile, dotFile);
            DotCount++;
        }
Exemple #4
0
 public void Non_Existent_File_Yields_ExitCode_1()
 {
     Assert.AreEqual(
         1,
         ProcessExtensions.Execute(testRunner, Quote("no-such.dll")).ExitCode);
 }
Exemple #5
0
 public void Fail_Yields_ExitCode_1()
 {
     Assert.AreEqual(
         1,
         ProcessExtensions.Execute(testRunner, Quote(failTests)).ExitCode);
 }
Exemple #6
0
 public void Pass_Yields_ExitCode_0()
 {
     Assert.AreEqual(
         0,
         ProcessExtensions.Execute(testRunner, Quote(passTests)).ExitCode);
 }
Exemple #7
0
 public void Non_DotNet_Dll_Yields_ExitCode_0()
 {
     Assert.AreEqual(
         0,
         ProcessExtensions.Execute(testRunner, Quote(fakeDll)).ExitCode);
 }
Exemple #8
0
 public void Non_Test_Assembly_Yields_ExitCode_0()
 {
     Assert.AreEqual(
         0,
         ProcessExtensions.Execute(testRunner, Quote(referencedAssembly)).ExitCode);
 }
Exemple #9
0
 public void Many_Assemblies_With_Different_Config_Files_Pass()
 {
     Assert.AreEqual(
         0,
         ProcessExtensions.Execute(testRunner, Quote(msTestTests, differentConfigTests)).ExitCode);
 }
Exemple #10
0
 public void One_Failing_Assembly_In_Many_Yields_ExitCode_1()
 {
     Assert.AreEqual(
         1,
         ProcessExtensions.Execute(testRunner, Quote(failTests, passTests)).ExitCode);
 }
 public void Succeeds()
 {
     Assert.AreEqual(
         0,
         ProcessExtensions.Execute(true, true, null, TestExe));
 }
 public void Returns_Correct_ExitCode()
 {
     Assert.AreEqual(
         123,
         ProcessExtensions.Execute(true, true, null, TestExe, "123"));
 }