Пример #1
0
        private BsgDetail FindForm(string formId, Sections section)
        {
            var query = new FindBsgSection
            {
                FormId  = formId,
                Section = section,
            };

            var form = Exec(query);

            return(form);
        }
        private NextSection NextSection(Sections?currentSection, Func <NextSection> nextSection)
        {
            var next = nextSection();

            if (next.Section.HasValue)
            {
                next.Type.Should().Be(NextType.Section);
                var detail = new FindBsgSection {
                    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);
        }
        public void Find_PopulatesDetail()
        {
            var existingForm = new BestStartGrantBuilder("form123")
                               .WithCompletedSections()
                               .Insert();

            var query = new FindBsgSection
            {
                FormId  = "form123",
                Section = Sections.ExistingChildren,
            };

            var detail = query.Find();

            var expectedDetail = new BsgDetail {
                PreviousSection = Sections.ExpectedChildren
            };

            BestStartGrantBuilder.CopySectionsFrom(existingForm, expectedDetail);

            detail.ShouldBeEquivalentTo(expectedDetail);
        }