public void GetFilterExpressionForNullRunContextReturnsNull() { TestableTestExecutionRecorder recorder = new TestableTestExecutionRecorder(); var filterExpression = this.TestMethodFilter.GetFilterExpression(null, recorder, out var filterHasError); Assert.IsNull(filterExpression); Assert.IsFalse(filterHasError); }
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); }
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); }
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); }
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); }
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); }