예제 #1
0
        public void GetFilterExpressionForNullRunContextReturnsNull()
        {
            TestableTestExecutionRecorder recorder = new TestableTestExecutionRecorder();
            var filterExpression = this.TestMethodFilter.GetFilterExpression(null, recorder, out var filterHasError);

            Assert.IsNull(filterExpression);
            Assert.IsFalse(filterHasError);
        }
예제 #2
0
        public void GetFilterExpressionForDiscoveryContextWithoutGetTestCaseFilterReturnsNullTestCaseFilterExpression()
        {
            TestableTestExecutionRecorder recorder = new TestableTestExecutionRecorder();
            TestableDiscoveryContextWithoutGetTestCaseFilter discoveryContext = new TestableDiscoveryContextWithoutGetTestCaseFilter();
            var filterExpression = this.TestMethodFilter.GetFilterExpression(discoveryContext, recorder, out var filterHasError);

            Assert.IsNull(filterExpression);
            Assert.IsFalse(filterHasError);
        }
예제 #3
0
        public void GetFilterExpressionForDiscoveryContextWithGetTestCaseFilterReturnsValidTestCaseFilterExpression()
        {
            TestableTestExecutionRecorder recorder = new TestableTestExecutionRecorder();
            var dummyFilterExpression = new TestableTestCaseFilterExpression();
            TestableDiscoveryContextWithGetTestCaseFilter discoveryContext = new TestableDiscoveryContextWithGetTestCaseFilter(() => dummyFilterExpression);
            var filterExpression = this.TestMethodFilter.GetFilterExpression(discoveryContext, recorder, out var filterHasError);

            Assert.AreEqual(dummyFilterExpression, filterExpression);
            Assert.IsFalse(filterHasError);
        }
예제 #4
0
        public void GetFilterExpressionForDiscoveryContextWithGetTestCaseFilterThrowingExceptionReturnsNullWithFilterHasErrorTrue()
        {
            TestableTestExecutionRecorder recorder = new TestableTestExecutionRecorder();
            TestableDiscoveryContextWithGetTestCaseFilter discoveryContext = new TestableDiscoveryContextWithGetTestCaseFilter(() => { throw new TestPlatformFormatException("DummyException"); });
            var filterExpression = this.TestMethodFilter.GetFilterExpression(discoveryContext, recorder, out var filterHasError);

            Assert.IsNull(filterExpression);
            Assert.IsTrue(filterHasError);
            Assert.AreEqual("DummyException", recorder.Message);
            Assert.AreEqual(TestMessageLevel.Error, recorder.TestMessageLevel);
        }
예제 #5
0
        public void GetFilterExpressionForValidRunContextReturnsValidTestCaseFilterExpression()
        {
            TestableTestExecutionRecorder recorder = new TestableTestExecutionRecorder();
            var dummyFilterExpression     = new TestableTestCaseFilterExpression();
            TestableRunContext runContext = new TestableRunContext(() => dummyFilterExpression);
            bool filterHasError;
            var  filterExpression = this.TestMethodFilter.GetFilterExpression(runContext, recorder, out filterHasError);

            Assert.AreEqual(dummyFilterExpression, filterExpression);
            Assert.AreEqual(false, filterHasError);
        }
예제 #6
0
        public void GetFilterExpressionForRunContextGetTestCaseFilterThrowingExceptionReturnsNullWithFilterHasErrorTrue()
        {
            TestableTestExecutionRecorder recorder   = new TestableTestExecutionRecorder();
            TestableRunContext            runContext = new TestableRunContext(() => { throw new TestPlatformFormatException("DummyException"); });
            bool filterHasError;
            var  filterExpression = this.TestMethodFilter.GetFilterExpression(runContext, recorder, out filterHasError);

            Assert.AreEqual(null, filterExpression);
            Assert.AreEqual(true, filterHasError);
            Assert.AreEqual("DummyException", recorder.Message);
            Assert.AreEqual(TestMessageLevel.Error, recorder.TestMessageLevel);
        }