Beispiel #1
0
        public void Fixture_contains_newly_added_test()
        {
            testFixture = new Core.TestFixture();
            var newTest = new Core.TestCase(() => { }, () => { });

            testFixture.Add(newTest);
            var tesetFromCollection = testFixture.Get(0);

            Assert.Equal(newTest, tesetFromCollection);
        }
Beispiel #2
0
        public void Returned_object_contains_information_about_not_run_test_result()
        {
            //Arrange
            testCase = new Core.TestCase(() => { }, () => { });

            //Act
            var report = testCase.GetReport();

            //Assert
            Assert.Equal(TestResult.NotRun, report.Result);
        }
Beispiel #3
0
        public void Contains_test_method_name()
        {
            //Arrange
            testCase = new Core.TestCase(TestMethod, () => { });

            //Act
            var report = testCase.GetReport();

            //Assert
            Assert.Equal("TestMethod", report.Name);
        }
Beispiel #4
0
        public void Contains_empty_case_if_test_not_run()
        {
            //Arrange
            testCase = new Core.TestCase(
                () => { },
                () => {}
                );

            //Act
            var report = testCase.GetReport();

            //Assert
            Assert.Empty(report.Case);
        }
Beispiel #5
0
        public void Contains_test_run_fail_as_case_if_test_run_fail()
        {
            //Arrange
            testCase = new Core.TestCase(
                () => { throw new System.Exception(); },
                () => { }
                );

            //Act
            testCase.Run();
            var report = testCase.GetReport();

            //Assert
            Assert.Equal("Test run failed", report.Case);
        }
Beispiel #6
0
        public void Returned_object_contains_information_about_failed_test_result()
        {
            //Arrange
            testCase = new Core.TestCase(
                () => { throw new System.Exception(); },
                () => { }
                );

            //Act
            testCase.Run();
            var report = testCase.GetReport();

            //Assert
            Assert.Equal(TestResult.Failed, report.Result);
        }
Beispiel #7
0
        public void Contains_assertion_exception_if_test_failed()
        {
            //Arrange
            testCase = new Core.TestCase(
                () => { throw new AssertException("Assertion message"); },
                () => { }
                );

            //Act
            testCase.Run();
            var report = testCase.GetReport();

            //Assert
            Assert.Equal(typeof(AssertException), report.Exception.GetType());
            Assert.Equal("Assertion message", report.Exception.Message);
        }
Beispiel #8
0
        public void Contains_setup_exception_if_setup_fail()
        {
            //Arrange
            testCase = new Core.TestCase(
                () => { },
                () => { throw new System.Exception("Error message"); }
                );

            //Act
            testCase.Run();
            var report = testCase.GetReport();

            //Assert
            Assert.Equal(typeof(System.Exception), report.Exception.GetType());
            Assert.Equal("Error message", report.Exception.Message);
        }
Beispiel #9
0
        public void Whole_fixture_pass_after_all_tests_passed()
        {
            //Arrange
            testFixture = new Core.TestFixture();
            var failedTest      = new Core.TestCase(() => { }, () => { });
            var succsessfulTest = new Core.TestCase(() => { }, () => { });

            testFixture.Add(succsessfulTest);
            testFixture.Add(failedTest);

            //Act
            testFixture.Run();
            var report = testFixture.GetReport();

            //Assert
            Assert.Equal(TestResult.Passed, report.Result);
        }
Beispiel #10
0
        public void Whole_fixture_fails_after_at_least_one_test_fails()
        {
            //Arrange
            testFixture = new Core.TestFixture();
            var failedTest      = new Core.TestCase(() => { }, () => throw new Exception());
            var succsessfulTest = new Core.TestCase(() => { }, () => { });

            testFixture.Add(succsessfulTest);
            testFixture.Add(failedTest);

            //Act
            testFixture.Run();
            var report = testFixture.GetReport();

            //Assert
            Assert.Equal(TestResult.Failed, report.Result);
        }