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;
        }
        public TestBuilder BuildNJasmineTestSuite(string parentName, string name, FixtureDiscoveryContext buildContext, GlobalSetupManager globalSetup, Action action, bool isOuterScopeOfSpecification)
        {
            var position = _position;

            var resultBuilder = new TestBuilder(_nativeTestFactory.ForSuite(position, () => _globalSetup.Cleanup(position)));
            resultBuilder.FullName = parentName + "." + name;
            resultBuilder.Shortname = name;
            resultBuilder.MultilineName = resultBuilder.FullName;

            return RunSuiteAction(buildContext, globalSetup, action, isOuterScopeOfSpecification, resultBuilder);
        }
Example #3
0
        public void ApplyResultToTest(TestBuilder builder)
        {
            _test.TestName.Name = builder.Shortname;
            _test.TestName.FullName = builder.FullName;
            TestExtensions.SetMultilineName(_test, builder.MultilineName);

            if (builder.ReasonIgnored != null)
            {
                _test.RunState = RunState.Explicit;
                _test.IgnoreReason = builder.ReasonIgnored;
            }

            foreach (var category in builder.Categories)
                NUnitFrameworkUtil.ApplyCategoryToTest(category, _test);

            foreach (var child in builder.Children)
            {
                (_test as TestSuite).Add((child.GetUnderlyingTest() as NativeTest).GetNative(child));
            }
        }
Example #4
0
 public void AddChildTest(TestBuilder test)
 {
     Children.Add(test);
 }
Example #5
0
 public Test GetNative(TestBuilder builder)
 {
     ApplyResultToTest(builder);
     return _test;
 }