Exemple #1
0
 public override TestResult Run(EventListener listener, ITestFilter filter)
 {
     listener.SuiteStarted(TestName);
     var result = new TestResult(this);
     try {
         ITestResult resultAdapter = new NUnitTestResultAdapter(result);
         fixture.WithInitialized(_ => {
             foreach(var item in Tests.Cast<Test>().Where(filter.Pass).Select(x => x.Run(listener, filter)))
      						result.AddResult(item);
             }, ex => {
                 resultAdapter.BeforeFailure(ex);
                 foreach(Test item in Tests) {
                     var failure = new TestResult(item);
                     listener.TestStarted(item.TestName);
                     failure.Error(ex, FailureSite.SetUp);
                     listener.TestFinished(failure);
                     result.AddResult(failure);
             }
         }, resultAdapter.AfterFailure);
     } finally {
         listener.SuiteFinished(result);
     }
     return result;
 }
 public void should_expose_Context()
 {
     var adapter = new NUnitTestResultAdapter(TestResult);
     Check.That(() => adapter.TestName.FullName == "Context.TestName");
 }
 public void should_expose_TestName()
 {
     var adapter = new NUnitTestResultAdapter(TestResult);
     Check.That(() => adapter.TestName.Name == "TestName");
 }
 public void reports_setup_failure()
 {
     ITestResult adapter = new NUnitTestResultAdapter(TestResult);
     adapter.BeforeFailure(new Exception());
     Check.That(() => adapter.Status == TestStatus.SetupFailure);
 }