Ejemplo n.º 1
0
 public TestExecutor(IConeFixture fixture)
 {
     this.fixture = fixture;
     var interceptorContext = TestExecutionContext.For(fixture);
     if(!interceptorContext.IsEmpty)
         fixtureContext = new[]{ interceptorContext };
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
        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 { }
        }
Ejemplo n.º 4
0
 public FixtureContext(IConeFixture fixture, IConeAttributeProvider attributes)
 {
     this.attributes = attributes;
     this.fixture = fixture;
 }
Ejemplo n.º 5
0
 TestExecutionContext(IConeFixture fixture)
 {
     this.fixture = fixture;
 }
Ejemplo n.º 6
0
 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();
     }
 }
Ejemplo n.º 7
0
 public ValueResultTestMethod(IConeFixture fixture, MethodInfo method, object expectedResult)
     : base(fixture, method)
 {
     this.expectedResult = expectedResult;
 }
Ejemplo n.º 8
0
 public ExpectedExceptionTestMethod(IConeFixture fixture, MethodInfo method, Type expectedExceptionType)
     : base(fixture, method)
 {
     this.expectedExceptionType = expectedExceptionType;
 }
Ejemplo n.º 9
0
 public ConeTestMethod(IConeFixture fixture, MethodInfo method)
 {
     this.fixture = fixture;
     this.method = method;
 }