示例#1
0
        public void RunTestsForTestWithFilterShouldSendResultsForFilteredTests()
        {
            var testCase        = this.GetTestCase(typeof(DummyTestClass), "PassingTest");
            var failingTestCase = this.GetTestCase(typeof(DummyTestClass), "FailingTest");

            TestCase[] tests = new[] { testCase, failingTestCase };

            this.runContext = new TestableRunContextTestExecutionTests(() => new TestableTestCaseFilterExpression((p) => (p.DisplayName == "PassingTest")));

            this.TestExecutionManager.RunTests(tests, this.runContext, this.frameworkHandle, this.cancellationToken);

            // FailingTest should be skipped because it does not match the filter criteria.
            List <string> expectedTestCaseStartList = new List <string>()
            {
                "PassingTest"
            };
            List <string> expectedTestCaseEndList = new List <string>()
            {
                "PassingTest:Passed"
            };
            List <string> expectedResultList = new List <string>()
            {
                "PassingTest  Passed"
            };

            CollectionAssert.AreEqual(expectedTestCaseStartList, this.frameworkHandle.TestCaseStartList);
            CollectionAssert.AreEqual(expectedTestCaseEndList, this.frameworkHandle.TestCaseEndList);
            CollectionAssert.AreEqual(expectedResultList, this.frameworkHandle.ResultsList);
        }
示例#2
0
        public void TestInit()
        {
            this.runContext        = new TestableRunContextTestExecutionTests(() => new TestableTestCaseFilterExpression((p) => true));
            this.frameworkHandle   = new TestableFrameworkHandle();
            this.cancellationToken = new TestRunCancellationToken();

            this.TestExecutionManager = new TestExecutionManager();
        }
示例#3
0
        public void RunTestsForTestWithFilterErrorShouldSendZeroResults()
        {
            var testCase = this.GetTestCase(typeof(DummyTestClass), "PassingTest");

            TestCase[] tests = new[] { testCase };

            // Causing the FilterExpressionError
            this.runContext = new TestableRunContextTestExecutionTests(() => { throw new TestPlatformFormatException(); });

            this.TestExecutionManager.RunTests(tests, this.runContext, this.frameworkHandle, this.cancellationToken);

            // No Results
            Assert.AreEqual(0, this.frameworkHandle.TestCaseStartList.Count);
            Assert.AreEqual(0, this.frameworkHandle.ResultsList.Count);
            Assert.AreEqual(0, this.frameworkHandle.TestCaseEndList.Count);
        }