public Test BuildNJasmineTestSuite(FixtureDiscoveryContext buildContext, GlobalSetupManager globalSetup, Action action, bool isOuterScopeOfSpecification) { var builder = new NJasmineTestSuiteBuilder(this, buildContext, globalSetup); var exception = buildContext.RunActionWithVisitor(Position.GetFirstChildPosition(), action, builder); if (exception == null) { builder.VisitAccumulatedTests(Add); } else { var nJasmineInvalidTestSuite = new NJasmineInvalidTestSuite(exception, Position); nJasmineInvalidTestSuite.TestName.FullName = TestName.FullName; nJasmineInvalidTestSuite.TestName.Name = TestName.Name; nJasmineInvalidTestSuite.SetMultilineName(this.GetMultilineName()); if (isOuterScopeOfSpecification) { Add(nJasmineInvalidTestSuite); } else { return nJasmineInvalidTestSuite; } } return this; }
public Test BuildNJasmineTestSuite(AllSuitesBuildContext buildContext, GlobalSetupManager globalSetup, Action action, bool isOuterScopeOfSpecification) { var builder = new NJasmineTestSuiteBuilder(this, buildContext, globalSetup); Exception exception = null; var originalVisitor = buildContext._fixtureInstanceForDiscovery.Visitor; buildContext._fixtureInstanceForDiscovery.CurrentPosition = Position; buildContext._fixtureInstanceForDiscovery.CurrentPosition = buildContext._fixtureInstanceForDiscovery.CurrentPosition.GetFirstChildPosition(); buildContext._fixtureInstanceForDiscovery.Visitor = builder; try { try { action(); } catch (Exception e) { exception = e; } if (exception == null) { builder.VisitAccumulatedTests(Add); } else { var nJasmineInvalidTestSuite = new NJasmineInvalidTestSuite(exception, Position); nJasmineInvalidTestSuite.TestName.FullName = TestName.FullName; nJasmineInvalidTestSuite.TestName.Name = TestName.Name; nJasmineInvalidTestSuite.SetMultilineName(this.GetMultilineName()); if (isOuterScopeOfSpecification) { Add(nJasmineInvalidTestSuite); } else { return nJasmineInvalidTestSuite; } } } finally { buildContext._fixtureInstanceForDiscovery.Visitor = originalVisitor; } return this; }