Beispiel #1
0
        public static NextSection Next(ChangeOfCircs form, Sections completedSection)
        {
            var index = _order.IndexOf(completedSection) + 1;

            Sections?nextSection = null;

            while (!nextSection.HasValue && index < _order.Count)
            {
                var section = _order[index];

                if (!FeatureToggles.SkipWorkInProgressSection(section))
                {
                    var strategy = SectionStrategy.For(section);

                    if (strategy.Required(form))
                    {
                        nextSection = section;
                    }
                    else
                    {
                        strategy.SkipSection(form);
                    }
                }

                index++;
            }

            return(new NextSection
            {
                Id = form.Id,
                Section = nextSection,
            });
        }
Beispiel #2
0
        public static NextSection Next(BestStartGrant form, Sections completedSection)
        {
            if (IsIneligible(form, completedSection))
            {
                return new NextSection
                       {
                           Id      = form.Id,
                           Type    = NextType.Ineligible,
                           Section = null,
                       }
            }
            ;

            var index = _order.IndexOf(completedSection) + 1;

            Sections?nextSection = null;

            while (!nextSection.HasValue && index < _order.Count)
            {
                var section = _order[index];

                if (!FeatureToggles.SkipWorkInProgressSection(section))
                {
                    var strategy = SectionStrategy.For(section);

                    if (strategy.Required(form))
                    {
                        nextSection = section;
                    }
                    else
                    {
                        strategy.SkipSection(form);
                    }
                }

                index++;
            }

            return(new NextSection
            {
                Id = form.Id,
                Type = nextSection.HasValue ? NextType.Section : NextType.Complete,
                Section = nextSection,
            });
        }
        public void AllSectionsHaveActions()
        {
            var sectionActions = new List <string>();

            foreach (Sections section in Enum.GetValues(typeof(Sections)))
            {
                if (FeatureToggles.SkipWorkInProgressSection(section))
                {
                    continue;
                }

                var strategy = SectionActionStrategy.For(section);
                var action   = strategy.Action("formId");
                action.Should().NotBeNullOrWhiteSpace();
                action.Should().Contain("formId");

                sectionActions.Contains(action).Should().BeFalse("Action {0} should only be used once", action);
                sectionActions.Add(action);
            }
        }
Beispiel #4
0
        public static void Populate(CocDetail detail, Sections section, ChangeOfCircs form)
        {
            var index = _order.IndexOf(section) - 1;

            while (index >= 0 && !detail.PreviousSection.HasValue)
            {
                var previousSection = _order[index];

                if (!FeatureToggles.SkipWorkInProgressSection(previousSection))
                {
                    var strategy = SectionStrategy.For(previousSection);

                    if (strategy.Required(form))
                    {
                        detail.PreviousSection = previousSection;
                    }
                }

                index--;
            }

            detail.IsFinalSection = (section == _order.Last());
        }
Beispiel #5
0
        protected void TestFixtureTearDown()
        {
            base.TearDown();

            if (TestRegistry.TestHasFailed)
            {
                return;
            }

            if (!_runningAlltests)
            {
                return;
            }

            // verify each section has been tested
            foreach (Sections section in Enum.GetValues(typeof(Sections)))
            {
                if (!FeatureToggles.SkipWorkInProgressSection(section))
                {
                    _verifiedSections.Should().Contain(section, "section {0} should be filled in and verified", section);
                }
            }
        }