private CocDetail FindForm(string formId, Sections section)
        {
            var query = new FindCocSection
            {
                FormId  = formId,
                Section = section,
            };

            var form = Exec(query);

            return(form);
        }
Ejemplo n.º 2
0
        private NextSection NextSection(Sections?currentSection, Func <NextSection> nextSection)
        {
            var next = nextSection();

            if (next.Section.HasValue)
            {
                var detail = new FindCocSection {
                    FormId = next.Id, Section = next.Section.Value
                }.Find();
                detail.PreviousSection.Should().Be(currentSection);
                detail.IsFinalSection.Should().Be(Navigation.Order.Last() == next.Section.Value, "Expected {0} to be the final section", next.Section.Value);
            }

            return(next);
        }
Ejemplo n.º 3
0
        public void Find_PopulatesExistingDetail_IfCurrentDetailDoesNotExist()
        {
            var existingForm = new ChangeOfCircsBuilder("form123")
                               .WithCompletedSections(excludeOptionalSections: true)
                               .Insert();

            var query = new FindCocSection
            {
                FormId  = "form123",
                Section = Sections.Consent,
            };

            var details = query.Find();

            var expectedDetail = new CocDetail {
                PreviousSection = null
            };

            ChangeOfCircsBuilder.CopySectionsFrom(existingForm, expectedDetail, useExisting: true);

            details.ShouldBeEquivalentTo(expectedDetail);
        }
Ejemplo n.º 4
0
        public void Find_PopulatesDetail()
        {
            var existingForm = new ChangeOfCircsBuilder("form123")
                               .WithCompletedSections(markAsCompleted: false)
                               .Insert();

            var query = new FindCocSection
            {
                FormId  = "form123",
                Section = Sections.Consent,
            };

            var detail = query.Find();

            var expectedDetail = new CocDetail {
                PreviousSection = null
            };

            ChangeOfCircsBuilder.CopySectionsFrom(existingForm, expectedDetail);

            detail.ShouldBeEquivalentTo(expectedDetail);
        }