public void Should_notify_starting_and_finishing_each_class()
        {
            var testRun = new TestRun();
            var testClass1 = testRun.AddClass("TestNamespace.TestClass1");
            testClass1.AddPassingTest("TestMethod");
            var testClass2 = testRun.AddClass("TestNamespace.TestClass2");
            testClass2.AddPassingTest("OtherTestMethod");

            testRun.Run();

            testRun.Messages.OfTask(testClass1.ClassTask).AssertOrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
            testRun.Messages.OfTask(testClass2.ClassTask).AssertOrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
        }
Ejemplo n.º 2
0
        public void Should_notify_starting_and_finishing_each_class()
        {
            var testRun    = new TestRun();
            var testClass1 = testRun.AddClass("TestNamespace.TestClass1");

            testClass1.AddPassingTest("TestMethod");
            var testClass2 = testRun.AddClass("TestNamespace.TestClass2");

            testClass2.AddPassingTest("OtherTestMethod");

            testRun.Run();

            testRun.Messages.AssertSameTask(testClass1.ClassTask).OrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
            testRun.Messages.AssertSameTask(testClass2.ClassTask).OrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
        }
        public void Should_continue_running_classes_after_test_class_failure()
        {
            var testRun = new TestRun();
            var testClass1 = testRun.AddClass("TestNamespace.TestClass1");
            testClass1.AddFixture<ThrowingFixture>();
            testClass1.AddPassingTest("TestMethod");

            var testClass2 = testRun.AddClass("TestNamespace.TestClass2");
            testClass2.AddPassingTest("OtherTestMethod");

            testRun.Run();

            testRun.Messages.OfTask(testClass1.ClassTask).AssertOrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
            testRun.Messages.OfTask(testClass2.ClassTask).AssertOrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
        }
        public void Should_continue_running_classes_after_failing_tests()
        {
            var testRun = new TestRun();
            var testClass1 = testRun.AddClass("TestNamespace.TestClass1");
            testClass1.AddFailingTest("TestMethod", new EqualException(23, 186));
            var testClass2 = testRun.AddClass("TestNamespace.TestClass2");
            testClass2.AddPassingTest("OtherTestMethod");

            testRun.Run();

            testRun.Messages.OfTask(testClass1.ClassTask).AssertTaskStarting();
            testRun.Messages.OfTask(testClass1.ClassTask).AssertTaskFinishedWithFailingChildren();

            testRun.Messages.OfTask(testClass2.ClassTask).AssertTaskStarting();
            testRun.Messages.OfTask(testClass2.ClassTask).AssertTaskFinishedSuccessfully();
        }
Ejemplo n.º 5
0
        public static TestRun GetSingleClassRun()
        {
            var testRun = new TestRun();

            testRun.AddClass("TestsNamespace.TestClass");
            return(testRun);
        }
Ejemplo n.º 6
0
        public void Should_continue_running_classes_after_test_class_failure()
        {
            var testRun    = new TestRun();
            var testClass1 = testRun.AddClass("TestNamespace.TestClass1");

            testClass1.AddFixture <ThrowingFixture>();
            testClass1.AddPassingTest("TestMethod");

            var testClass2 = testRun.AddClass("TestNamespace.TestClass2");

            testClass2.AddPassingTest("OtherTestMethod");

            testRun.Run();

            testRun.Messages.AssertSameTask(testClass1.ClassTask).OrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
            testRun.Messages.AssertSameTask(testClass2.ClassTask).OrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
        }
 public When_fixture_throws_in_dispose()
 {
     testRun   = new TestRun();
     testClass = testRun.AddClass("TestNamespace.TestClass1");
     testClass.AddFixture <ThrowsInDispose>();
     ThrowsInDispose.Exception = new InvalidOperationException("Ooops");
     testClass.AddPassingTest("TestMethod1");
     testClass.AddPassingTest("TestMethod2");
 }
Ejemplo n.º 8
0
        public void Should_continue_running_classes_after_failing_tests()
        {
            var testRun    = new TestRun();
            var testClass1 = testRun.AddClass("TestNamespace.TestClass1");

            testClass1.AddFailingTest("TestMethod", new EqualException(23, 186));
            var testClass2 = testRun.AddClass("TestNamespace.TestClass2");

            testClass2.AddPassingTest("OtherTestMethod");

            testRun.Run();

            testRun.Messages.AssertSameTask(testClass1.ClassTask).TaskStarting();
            testRun.Messages.AssertSameTask(testClass1.ClassTask).TaskFinished();

            testRun.Messages.AssertSameTask(testClass2.ClassTask).TaskStarting();
            testRun.Messages.AssertSameTask(testClass2.ClassTask).TaskFinished();
        }
 public When_fixture_throws_in_dispose()
 {
     testRun = new TestRun();
     testClass = testRun.AddClass("TestNamespace.TestClass1");
     testClass.AddFixture<ThrowsInDispose>();
     ThrowsInDispose.Exception = new InvalidOperationException("Ooops");
     testClass.AddPassingTest("TestMethod1");
     testClass.AddPassingTest("TestMethod2");
 }
        public void Should_continue_running_other_classes()
        {
            var testClass2 = testRun.AddClass("TestNamespace.TestClass2");
            var testMethod = testClass2.AddPassingTest("OtherMethod");

            testRun.Run();

            testRun.Messages.OfTask(testClass2.ClassTask).AssertTaskStarting();
            testRun.Messages.OfTask(testMethod.Task).AssertOrderedActions(ServerAction.TaskStarting, ServerAction.TaskFinished);
            testRun.Messages.OfTask(testClass2.ClassTask).AssertTaskFinishedSuccessfully();
        }
Ejemplo n.º 11
0
        public void Should_continue_running_next_class()
        {
            // This only runs again because we use xunit's RunTests method, and call it once for each test class
            // If xunit were running the whole assembly, it would stop the run at the first error
            var nextClass = testRun.AddClass("TestsNamespace.TestClass2");
            var method    = nextClass.AddPassingTest("ValidTest");

            testRun.Run();

            testRun.Messages.OfTask(method.Task).AssertTaskFinishedSuccessfully();
            testRun.Messages.OfTask(nextClass.ClassTask).AssertTaskFinishedSuccessfully();
        }
Ejemplo n.º 12
0
 public static TestRun GetSingleClassRun()
 {
     var testRun = new TestRun();
     testRun.AddClass("TestsNamespace.TestClass");
     return testRun;
 }