public ReportSetUpAndTearDownEventArgs(ReportSetUpAndTearDown setUpAndTearDown) { if (setUpAndTearDown == null) { throw new ArgumentNullException("setUpAndTearDown"); } this.setUpAndTearDown = setUpAndTearDown; }
public void TestFixtureTearDown(Fixture fixture, ReportSetUpAndTearDown tearDown) { ReportFixture reportFixture = this.AddFixture(fixture); reportFixture.TearDown = tearDown; }
public void TestFixtureSetUp(Fixture fixture, ReportSetUpAndTearDown setUp) { ReportFixture reportFixture = this.AddFixture(fixture); reportFixture.SetUp = setUp; }
void RenderSetUpOrTearDownFailure(string context, ReportSetUpAndTearDown setup) { TestResult summary = new TestResult(); switch (setup.Result) { case ReportRunResult.Failure: summary.State = TDF.TestState.Failed; break; case ReportRunResult.Success: summary.State = TDF.TestState.Passed; break; } summary.TotalTests = this.testCount; summary.Name = String.Format("{0} {1}",context, setup.Name); summary.TimeSpan = new TimeSpan(0, 0, 0, 0, (int)(setup.Duration * 1000)); if (setup.Exception != null) { summary.Message = setup.Exception.Message; StringWriter sw = new StringWriter(); ReportException ex = setup.Exception; summary.StackTrace = ex.ToString(); } this.testListener.TestFinished(summary); }
protected virtual void RunFixtureTearDown(Fixture fixture, object fixtureInstance) { if (fixture == null) throw new ArgumentNullException("fixture"); ReportMonitor monitor = new ReportMonitor(); try { monitor.Start(); fixture.TearDown(fixtureInstance); monitor.Stop(); if (fixture.HasTearDown) { ReportSetUpAndTearDown tearDown = new ReportSetUpAndTearDown("TestFixtureTearDown", monitor); if (this.Report != null) this.Report.TestFixtureTearDown(fixture, tearDown); this.OnTestFixtureTearDown(new ReportSetUpAndTearDownEventArgs(tearDown)); } } catch (Exception ex) { monitor.Stop(); ReportSetUpAndTearDown tearDown = new ReportSetUpAndTearDown( "TestFixtureTearDown", monitor, ex); if (this.Report != null) this.Report.TestFixtureTearDown(fixture, tearDown); this.OnTestFixtureTearDown(new ReportSetUpAndTearDownEventArgs(tearDown)); } }
public virtual void VisitFixtureTearDown(ReportSetUpAndTearDown fixtureTearDown) { }
protected virtual object RunFixtureSetUp(Fixture fixture, object fixtureInstance) { if (fixture == null) throw new ArgumentNullException("fixture"); ReportMonitor monitor = new ReportMonitor(); try { if (fixture.HasSetUp) { monitor.Start(); fixture.SetUp(fixtureInstance); monitor.Stop(); ReportSetUpAndTearDown setup = new ReportSetUpAndTearDown("TestFixtureSetUp", monitor); if (this.Report!=null) this.Report.TestFixtureSetUp(fixture, setup); this.OnTestFixtureSetUp(new ReportSetUpAndTearDownEventArgs(setup)); } return fixtureInstance; } catch (Exception ex) { monitor.Stop(); if (fixture.HasSetUp) { ReportSetUpAndTearDown setup = new ReportSetUpAndTearDown("TestFixtureSetUp", monitor, ex); if (this.Report != null) this.Report.TestFixtureSetUp(fixture, setup); this.OnTestFixtureSetUp(new ReportSetUpAndTearDownEventArgs(setup)); } // fail all starters FixtureSetUpFailedException setUpEx = new FixtureSetUpFailedException(ex); FailStarters(fixture, monitor, setUpEx); // add error message return null; } }
public ReportSetUpAndTearDownEventArgs(ReportSetUpAndTearDown setUpAndTearDown) { if (setUpAndTearDown == null) throw new ArgumentNullException("setUpAndTearDown"); this.setUpAndTearDown = setUpAndTearDown; }
public void AssemblyTearDown(Assembly assembly, ReportSetUpAndTearDown tearDown) { ReportAssembly a = this.AddAssembly(assembly); a.TearDown = tearDown; }
private static ReportSetUpAndTearDown ExecuteAndMonitor(MethodInfo method) { if (method == null) throw new ArgumentNullException("method"); string name = String.Format("{0}.{1}", method.DeclaringType.FullName, method.Name); ReportMonitor monitor = new ReportMonitor(); try { monitor.Start(); method.Invoke(null, null); monitor.Stop(); ReportSetUpAndTearDown setup = new ReportSetUpAndTearDown(name,monitor); return setup; } catch (Exception ex) { monitor.Stop(); ReportSetUpAndTearDown setup = new ReportSetUpAndTearDown(name, monitor,ex); return setup; } }
public virtual void VisitAssemblyTearDown(ReportSetUpAndTearDown assemblyTearDown) { }
public void AssemblySetUp(Assembly assembly, ReportSetUpAndTearDown setUp) { ReportAssembly a = this.AddAssembly(assembly); a.SetUp = setUp; }