コード例 #1
0
        protected static BsgDetail NewBsgDetail(string formId, int childCount = 2)
        {
            var detail = new BsgDetail
            {
                Id = formId,

                Consent                 = ConsentBuilder.NewValid(),
                ApplicantDetails        = ApplicantDetailsBuilder.NewValid(),
                ExpectedChildren        = ExpectedChildrenBuilder.NewValid(),
                ExistingChildren        = ExistingChildrenBuilder.NewValid(childCount),
                ApplicantBenefits       = BenefitsBuilder.NewWithBenefit(),
                PartnerBenefits         = BenefitsBuilder.NewWithBenefit(),
                GuardianBenefits        = BenefitsBuilder.NewWithBenefit(),
                GuardianPartnerBenefits = BenefitsBuilder.NewWithBenefit(),
                PartnerDetails          = RelationDetailsBuilder.NewValid("partner"),
                GuardianDetails         = RelationDetailsBuilder.NewValid("guardian"),
                GuardianPartnerDetails  = RelationDetailsBuilder.NewValid("guardian partner"),
                HealthProfessional      = HealthProfessionalBuilder.NewValid(),
                PaymentDetails          = PaymentDetailsBuilder.NewValid(),
                Evidence                = EvidenceBuilder.NewValid(),
                Declaration             = DeclarationBuilder.NewValid(),
            };

            return(detail);
        }
コード例 #2
0
 private NextSection AddGuardianPartnerDetails(NextSection current, Action <RelationDetails> mutator = null)
 {
     current.Section.Should().Be(Sections.GuardianPartnerDetails);
     return(NextSection(current.Section, () => new AddGuardianPartnerDetails {
         FormId = current.Id, GuardianPartnerDetails = RelationDetailsBuilder.NewValid(mutator)
     }.Execute()));
 }
コード例 #3
0
        public BestStartGrantBuilder WithCompletedSections(bool markAsCompleted = true)
        {
            With(f => f.Consent, ConsentBuilder.NewValid());
            With(f => f.ApplicantDetails, ApplicantDetailsBuilder.NewValid());
            With(f => f.ExpectedChildren, ExpectedChildrenBuilder.NewValid());
            With(f => f.ExistingChildren, ExistingChildrenBuilder.NewValid());
            With(f => f.ApplicantBenefits, BenefitsBuilder.NewWithBenefit());
            With(f => f.PartnerBenefits, BenefitsBuilder.NewWithBenefit());
            With(f => f.GuardianBenefits, BenefitsBuilder.NewWithBenefit());
            With(f => f.GuardianPartnerBenefits, BenefitsBuilder.NewWithBenefit());
            With(f => f.PartnerDetails, RelationDetailsBuilder.NewValid("partner"));
            With(f => f.GuardianDetails, RelationDetailsBuilder.NewValid("guardian"));
            With(f => f.GuardianPartnerDetails, RelationDetailsBuilder.NewValid("guardian partner"));
            With(f => f.HealthProfessional, HealthProfessionalBuilder.NewValid());
            With(f => f.PaymentDetails, PaymentDetailsBuilder.NewValid());
            With(f => f.Evidence, EvidenceBuilder.NewValid());
            With(f => f.Declaration, DeclarationBuilder.NewValid());

            With(f => f.Started, DomainRegistry.NowUtc() - TimeSpan.FromHours(24));
            With(f => f.Completed, DomainRegistry.NowUtc());
            With(f => f.UserId, _instance.ApplicantDetails?.EmailAddress);
            VerifyConsistent(_instance);

            if (!markAsCompleted)
            {
                With(f => f.Completed, null);
            }

            return(this);
        }
        public void AddPartnerDetails_SetsRelationshipAutomatically()
        {
            var form = new BestStartGrantBuilder("form").Insert();

            form.AddPartnerDetails(RelationDetailsBuilder.NewValid(rd => rd.RelationshipToApplicant = null));

            form.PartnerDetails.RelationshipToApplicant.Should().Be("Partner");
        }
        public void AddGuardianPartnerDetails_FormatsNationalInsuranceNumber()
        {
            var form = new BestStartGrantBuilder("form").Insert();

            var details = RelationDetailsBuilder.NewValid(d => d.NationalInsuranceNumber = "AB123456C");

            form.AddGuardianPartnerDetails(details);

            form.GuardianPartnerDetails.NationalInsuranceNumber.Should().Be("AB 12 34 56 C");
        }
        public void AddPartnerDetails_AllowsAddressToBeInherited()
        {
            var form = new BestStartGrantBuilder("form")
                       .With(f => f.PartnerDetails, RelationDetailsBuilder.NewValid())
                       .Insert();

            var inheritedDetails = RelationDetailsBuilder.NewValid(rd =>
            {
                rd.InheritAddress = true;
                rd.Address        = null;
            });

            form.AddPartnerDetails(inheritedDetails);

            form.PartnerDetails.InheritAddress.Should().BeTrue();
            form.PartnerDetails.Address.Should().BeNull();
        }
コード例 #7
0
        public void Execute_StoresGuardianPartnerDetails()
        {
            var existingForm = new BestStartGrantBuilder("form123")
                               .With(f => f.GuardianPartnerDetails, RelationDetailsBuilder.NewValid())
                               .Insert();

            existingForm.GuardianPartnerDetails.Address.Line1.Should().NotBeNull();

            var cmd = new AddGuardianPartnerDetails
            {
                FormId = "form123",
                GuardianPartnerDetails = RelationDetailsBuilder.NewValid(),
            };

            cmd.Execute();

            var updatedForm = Repository.Load <BestStartGrant>("form123");

            updatedForm.GuardianPartnerDetails.Should().NotBeNull();
            updatedForm.GuardianPartnerDetails.Address.Line1.Should().Be(cmd.GuardianPartnerDetails.Address.Line1);
        }
 protected void GuardianPartnerDetailsShouldBeInvalid(BestStartGrant form, Action <RelationDetails> mutator)
 {
     ShouldBeInvalid(() => form.AddGuardianPartnerDetails(RelationDetailsBuilder.NewValid(mutator)));
 }