public TestExecutor(IConeFixture fixture) { this.fixture = fixture; var interceptorContext = TestExecutionContext.For(fixture); if(!interceptorContext.IsEmpty) fixtureContext = new[]{ interceptorContext }; }
public static TestExecutionContext For(IConeFixture fixture) { var context = new TestExecutionContext(fixture); fixture.FixtureType.GetFields() .ForEachWhere( x => x.FieldType.Implements<ITestContext>(), context.testContexts.Add); return context; }
void CollectResults(IEnumerable<IConeTest> tests, IConeFixture fixture, ISuiteLogger suiteLog) { var testExecutor = GetTestExecutor(fixture); var beforeFailure = new Lazy<Exception>(() => Initiaize(testExecutor)); tests.ForEach(test => suiteLog.WithTestLog(test, log => { if(ShouldSkipTest(test)) log.Skipped(); else { ITestResult result = new TestResult(test, log); if(beforeFailure.Value != null) result.BeforeFailure(beforeFailure.Value); else testExecutor.Run(test, result); } })); try { testExecutor.Relase(); } catch { } }
public FixtureContext(IConeFixture fixture, IConeAttributeProvider attributes) { this.attributes = attributes; this.fixture = fixture; }
TestExecutionContext(IConeFixture fixture) { this.fixture = fixture; }
static ConeTestMethod NewTestMethod(IConeFixture fixture, MethodInfo method, ExpectedTestResult result) { switch(result.ResultType) { case ExpectedTestResultType.None: return new ConeTestMethod(fixture, method); case ExpectedTestResultType.Value: return new ValueResultTestMethod(fixture, method, result.ExpectedResult); case ExpectedTestResultType.Exception: return new ExpectedExceptionTestMethod(fixture, method, (Type)result.ExpectedResult); default: throw new NotSupportedException(); } }
public ValueResultTestMethod(IConeFixture fixture, MethodInfo method, object expectedResult) : base(fixture, method) { this.expectedResult = expectedResult; }
public ExpectedExceptionTestMethod(IConeFixture fixture, MethodInfo method, Type expectedExceptionType) : base(fixture, method) { this.expectedExceptionType = expectedExceptionType; }
public ConeTestMethod(IConeFixture fixture, MethodInfo method) { this.fixture = fixture; this.method = method; }