private static bool ExecuteIfExists(TestRunner runner, MethodInfo m) { if (m != null) { Write(string.Format(" Executing: {0}", m.Name), ConsoleColor.DarkGray); if (!runner.Execute(m)) { WriteLine(" Failed", ConsoleColor.Red); return false; } Console.WriteLine(); } return true; }
private static void ExecuteTest(ref int apassed, ref int afailed, TestRunner runner, ref int cpassed, ref int cfailed, System.Reflection.MethodInfo m) { Console.Write(" {0}: ", m.Name); var result = runner.Execute(m); if (result) { WriteLine("Passed", ConsoleColor.Green); cpassed++; apassed++; } else { WriteLine("Failed", ConsoleColor.Red); cfailed++; afailed++; } }
public void TestRunnerShouldRunMultipleTestsOnSameInstance() { var runner = new TestRunner(typeof(TestDemoClass)); runner.Execute(typeof(TestDemoClass).GetMethod("MultipleFirst")); var result = runner.Execute(typeof(TestDemoClass).GetMethod("MultipleSecond")); Assert.IsTrue(result); }
public void TestRunnerExecuteClassInitializeOnStatic() { object instance = new TestDemoClass(); var runner = new TestRunner(instance); bool result = runner.Execute(typeof(TestDemoClass).GetMethod("ClassInit")); Assert.IsTrue(result); Assert.IsTrue(TestDemoClass.IsInitialized); }
public void TestExecuteOfTestMethod() { var runner = new TestRunner(typeof(TestDemoClass)); bool result = runner.Execute(typeof(TestDemoClass).GetMethod("MyTestMethod")); Assert.IsTrue(result); }
public void ExecuteOfMethodThrowingExpectedExceptionShouldReturnTrue() { var runner = new TestRunner(typeof(TestDemoClass)); bool result = runner.Execute(typeof(TestDemoClass).GetMethod("ThrowsExpectedException")); Assert.IsTrue(result); }
public void ExecuteOfFailingTestShouldReturnFalse() { var runner = new TestRunner(typeof(TestDemoClass)); bool result = runner.Execute(typeof(TestDemoClass).GetMethod("FailingTest")); Assert.IsFalse(result); }