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 AddEvidence(NextSection current, Action <Evidence> mutator = null) { current.Section.Should().Be(Sections.Evidence); return(NextSection(current.Section, () => new AddEvidence { FormId = current.Id, Evidence = EvidenceBuilder.NewValid(mutator) }.Execute())); }
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 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); }
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_StoresEvidence() { var existingForm = new ChangeOfCircsBuilder("form123") .With(f => f.Evidence, EvidenceBuilder.NewValid(e => e.SendingByPost = false)) .Insert(f => f.Evidence.AddFiles(f, 2)); existingForm.Evidence.SendingByPost.Should().BeFalse("not set before executing command"); existingForm.Evidence.Files.Count.Should().Be(2, "should have existing uploaded files"); var cmd = new AddEvidence { FormId = "form123", Evidence = EvidenceBuilder.NewValid(), }; cmd.Execute(); var updatedForm = Repository.Load <ChangeOfCircs>("form123"); updatedForm.Evidence.SendingByPost.Should().Be(cmd.Evidence.SendingByPost); updatedForm.Evidence.Files.Count.Should().Be(2, "files should not be overwritten"); }
protected void EvidenceShouldBeValid(ChangeOfCircs form, Action <Evidence> mutator) { Builder.Modify(form).With(f => f.Evidence, null); ShouldBeValid(() => form.AddEvidence(EvidenceBuilder.NewValid(mutator))); }
protected void EvidenceShouldBeValid(BestStartGrant form, Action <Evidence> mutator) { Builder.Modify(form).With(f => f.Evidence, null); ShouldBeValid(() => form.AddEvidence(EvidenceBuilder.NewValid(mutator))); }