Ejemplo n.º 1
0
        public TestBuilder RunSuiteAction(FixtureDiscoveryContext buildContext, GlobalSetupManager globalSetup, Action action,
            bool isOuterScopeOfSpecification, TestBuilder resultBuilder)
        {
            var builder = new NJasmineTestSuiteBuilder(_nativeTestFactory, resultBuilder, buildContext, globalSetup);

            var exception = buildContext.RunActionWithVisitor(_position.GetFirstChildPosition(), action, builder);

            if (exception == null)
            {
                builder.VisitAccumulatedTests(v => resultBuilder.AddChildTest(v));
            }
            else
            {
                var failingSuiteAsTest = new TestBuilder(_nativeTestFactory.ForFailingSuite(_position, exception));

                failingSuiteAsTest.FullName = resultBuilder.FullName;
                failingSuiteAsTest.Shortname = resultBuilder.Shortname;
                failingSuiteAsTest.MultilineName = resultBuilder.MultilineName;

                buildContext.NameGenator.ReserveName(failingSuiteAsTest);

                if (isOuterScopeOfSpecification)
                {
                    resultBuilder.AddChildTest(failingSuiteAsTest);
                }
                else
                {
                    return failingSuiteAsTest;
                }
            }
            return resultBuilder;
        }
Ejemplo n.º 2
0
        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;
        }