Ejemplo n.º 1
0
        public void TestStarted()
        {
            var test = new FakeTestCase(RUNNER_ID, TEST_ID, TEST_NAME, FULL_NAME);

            _eventAdapter.TestStarted(test.TestName);
            string expected = string.Format("<start-test id=\"{0}-{1}\" name=\"{2}\" fullname=\"{3}\"/>", RUNNER_ID, TEST_ID, TEST_NAME, FULL_NAME);

            Assert.That(_report, Is.EqualTo(expected));
        }
Ejemplo n.º 2
0
        public void TestFinished()
        {
            var test   = new FakeTestCase(RUNNER_ID, TEST_ID, TEST_NAME, FULL_NAME);
            var result = new TestResult(test);

            result.SetResult(ResultState.Failure, "MESSAGE", "STACKTRACE");
            result.Time        = 1.234;
            result.AssertCount = 5;
            _eventAdapter.TestFinished(result);
            string expected =
                string.Format("<test-case id=\"{0}-{1}\" name=\"{2}\" fullname=\"{3}\" methodname=\"FakeTestMethod\" classname=\"{4}\" runstate=\"Runnable\" result=\"Failed\" duration=\"1.234000\" asserts=\"5\"><failure><message><![CDATA[MESSAGE]]></message><stack-trace><![CDATA[STACKTRACE]]></stack-trace></failure></test-case>",
                              RUNNER_ID, TEST_ID, TEST_NAME, FULL_NAME, typeof(FakeTestCase).FullName);

            Assert.That(_report, Is.EqualTo(expected));
        }
Ejemplo n.º 3
0
        public void Should_Create_A_SkippedTestCase_If_Skip_Logic_Returns_A_Skip_Reason()
        {
            var conditionalFactDiscoverer = new ConditionalFactDiscoverer(mockedMessageSink);

            var skipReason = "A skip reason";

            SetUpSkipLogic(conditionalFactDiscoverer, FakeSkipLogic.Type, skipReason);
            var mockTestCaseFactory = new Mock <ITestCaseFactory>();
            var skipTestCase        = new FakeTestCase();

            mockTestCaseFactory.Setup(f => f.CreateSkip(skipReason, mockedMessageSink, mockedTestFrameworkDiscoveryOptions, mockedTestMethod)).Returns(skipTestCase);
            conditionalFactDiscoverer.TestCaseFactory = mockTestCaseFactory.Object;

            var testCases = conditionalFactDiscoverer.Discover(mockedTestFrameworkDiscoveryOptions, mockedTestMethod, GetReflectionAttributeInfo_DiscovererType(null, FakeSkipLogic.Type));

            Assert.Single(testCases);
            Assert.Same(skipTestCase, testCases.First());
        }
Ejemplo n.º 4
0
 public void SetUp()
 {
     _exception = new Exception("Something bad happened");
     _fakeTest = new FakeTestCase(() => { throw _exception; });
     _fakeTest.RecordAnyExceptionsThrown();
 }
Ejemplo n.º 5
0
 public void SetUp()
 {
     _exception = new Exception("Something bad happened");
     _fakeTest  = new FakeTestCase(() => { throw _exception; });
     _fakeTest.RecordAnyExceptionsThrown();
 }
 public void SetUp()
 {
     _fakeTest = new FakeTestCase();
     _fakeTest.Execute();
 }
Ejemplo n.º 7
0
 public void SetUp()
 {
     _fakeTest = new FakeTestCase(() => { throw new Exception("Something bad happened"); });
 }
Ejemplo n.º 8
0
 public void SetUp()
 {
     _fakeTest = new FakeTestCase(() => { throw new Exception("Something bad happened"); });
 }