Esempio n. 1
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);
        }
        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);
        }
 private NextSection AddConsent(NextSection current, Action <Consent> mutator = null)
 {
     current.Section.Should().Be(Sections.Consent);
     return(NextSection(current.Section, () => new AddConsent {
         FormId = current.Id, Consent = ConsentBuilder.NewValid(mutator)
     }.Execute()));
 }
Esempio n. 4
0
        public ChangeOfCircsBuilder WithCompletedSections(bool markAsCompleted = true, bool excludeOptionalSections = false)
        {
            With(f => f.Consent, ConsentBuilder.NewValid());
            With(f => f.UserId, "*****@*****.**");
            With(f => f.ExistingApplicantDetails, ApplicantDetailsBuilder.NewValid(ad => ad.Address = AddressBuilder.NewValid("existing")));
            With(f => f.ExistingPaymentDetails, PaymentDetailsBuilder.NewValid());
            With(f => f.Options, OptionsBuilder.NewValid());

            if (!excludeOptionalSections)
            {
                With(f => f.ApplicantDetails, ApplicantDetailsBuilder.NewValid());
                With(f => f.ExpectedChildren, ExpectedChildrenBuilder.NewValid());
                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());
            VerifyConsistent(_instance);

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

            return(this);
        }
        public void Complete_ThrowsIfAlreadyCompleted()
        {
            var form = new BestStartGrantBuilder("form")
                       .WithCompletedSections()
                       .Value();

            form.Completed.Should().HaveValue();

            Assert.Throws <DomainException>(() =>
                                            form.AddConsent(ConsentBuilder.NewValid()));
        }
Esempio n. 6
0
        protected static CocDetail NewCocDetail(string formId)
        {
            var detail = new CocDetail
            {
                Id = formId,

                Consent            = ConsentBuilder.NewValid(),
                Identity           = "*****@*****.**",
                Options            = OptionsBuilder.NewValid(),
                ApplicantDetails   = ApplicantDetailsBuilder.NewValid(),
                ExpectedChildren   = ExpectedChildrenBuilder.NewValid(),
                HealthProfessional = HealthProfessionalBuilder.NewValid(),
                PaymentDetails     = PaymentDetailsBuilder.NewValid(),
                Evidence           = EvidenceBuilder.NewValid(),
                Declaration        = DeclarationBuilder.NewValid(),
            };

            return(detail);
        }
        public void Execute_StoresConsent()
        {
            var existingForm = new ChangeOfCircsBuilder("form123")
                               .Insert();

            existingForm.Consent.Should().BeNull("no data stored before executing command");

            var cmd = new AddConsent
            {
                FormId  = "form123",
                Consent = ConsentBuilder.NewValid(),
            };

            cmd.Execute();

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

            updatedForm.Consent.Should().NotBeNull();
            updatedForm.Consent.AgreedToConsent.Should().Be(cmd.Consent.AgreedToConsent);
        }
 protected void ConsentShouldBeInvalid(BestStartGrant form, Action <Consent> mutator)
 {
     ShouldBeInvalid(() => form.AddConsent(ConsentBuilder.NewValid(mutator)));
 }
Esempio n. 9
0
 protected void ConsentShouldBeInvalid(ChangeOfCircs form, Action <Consent> mutator)
 {
     ShouldBeInvalid(() => form.AddConsent(ConsentBuilder.NewValid(mutator)));
 }