コード例 #1
0
        protected void ExpectedChildrenShouldBeValid(BestStartGrant form, Action <ExpectedChildren> mutator, Action <ExpectedChildren> postVerify = null)
        {
            var expectedChildren = ExpectedChildrenBuilder.NewValid(mutator);

            ShouldBeValid(() => form.AddExpectedChildren(expectedChildren));
            postVerify?.Invoke(expectedChildren);
        }
コード例 #2
0
        protected void PaymentDetailsShouldBeValid(BestStartGrant form, Action <PaymentDetails> mutator, Action <PaymentDetails> postVerify = null)
        {
            var paymentDetails = PaymentDetailsBuilder.NewValid(mutator);

            ShouldBeValid(() => form.AddPaymentDetails(paymentDetails));
            postVerify?.Invoke(paymentDetails);
        }
        public void ApplicantDetails_RequiresEducationQuestion()
        {
            TestNowUtc = new DateTime(2009, 08, 07, 06, 05, 04);
            var applicantDetails = ApplicantDetailsBuilder.NewValid();

            BestStartGrant.ShouldAskEducationQuestion(applicantDetails).Should().BeTrue("default builder should ask question");

            applicantDetails.DateOfBirth = null;
            BestStartGrant.ShouldAskEducationQuestion(applicantDetails).Should().BeFalse("no need to ask question if DoB not supplied");

            // applicant is 20 today
            applicantDetails.DateOfBirth = new DateTime(1989, 08, 07);
            BestStartGrant.ShouldAskEducationQuestion(applicantDetails).Should().BeFalse("no need to ask question if applicant >= 20");

            // applicant is 20 tomorrow (still 19)
            applicantDetails.DateOfBirth = new DateTime(1989, 08, 08);
            BestStartGrant.ShouldAskEducationQuestion(applicantDetails).Should().BeTrue("ask question if applicant is still 19");

            // applicant is 18 today
            applicantDetails.DateOfBirth = new DateTime(1991, 08, 07);
            BestStartGrant.ShouldAskEducationQuestion(applicantDetails).Should().BeTrue("ask question if applicant has turned 18");

            // applicant is 18 tomorrow
            applicantDetails.DateOfBirth = new DateTime(1991, 08, 08);
            BestStartGrant.ShouldAskEducationQuestion(applicantDetails).Should().BeFalse("no need to ask question if applicant is under 18");
        }
コード例 #4
0
        public void RequiresGuardianBenefits()
        {
            var form = new BestStartGrantBuilder("form")
                       .With(f => f.ApplicantDetails, ApplicantDetailsBuilder.NewValid())
                       .Value();

            form.ApplicantDetails.DateOfBirth = null;

            Navigation.RequiresGuardianBenefits(form).Should().BeFalse();

            form.ApplicantDetails.Over25(TestNowUtc.Value);
            form.ApplicantDetails.FullTimeEducation = true;
            BestStartGrant.ShouldAskEducationQuestion(form.ApplicantDetails).Should().BeFalse("question not relevant");

            Navigation.RequiresGuardianBenefits(form).Should().BeFalse("should not ask for guardian benefits if not 18 or 19");

            form.ApplicantDetails.Aged(TestNowUtc.Value, 18);
            form.ApplicantDetails.FullTimeEducation = false;
            BestStartGrant.ShouldAskEducationQuestion(form.ApplicantDetails).Should().BeTrue("ensure question is asked");

            Navigation.RequiresGuardianBenefits(form).Should().BeFalse("should not ask for guardian benefits if not in full time education");

            form.ApplicantDetails.Aged(TestNowUtc.Value, 19);
            form.ApplicantDetails.FullTimeEducation = true;
            BestStartGrant.ShouldAskEducationQuestion(form.ApplicantDetails).Should().BeTrue("ensure question is asked");

            Navigation.RequiresGuardianBenefits(form).Should().BeTrue("should ask for guardian benefits if responded in full time education");
        }
        protected void ApplicantDetailsShouldBeValid(BestStartGrant form, Action <ApplicantDetails> mutator, Action <ApplicantDetails> postVerify = null)
        {
            var applicantDetails = ApplicantDetailsBuilder.NewValid(mutator);

            ShouldBeValid(() => form.AddApplicantDetails(applicantDetails));
            postVerify?.Invoke(applicantDetails);
        }
コード例 #6
0
        public void RequiresApplicantBenefits_NotRequiredWhenCareLeaver()
        {
            var form = new BestStartGrantBuilder("form")
                       .With(f => f.ApplicantDetails, ApplicantDetailsBuilder.NewValid())
                       .Value();

            form.ApplicantDetails.DateOfBirth = null;

            Navigation.RequiresGuardianBenefits(form).Should().BeFalse();

            form.ApplicantDetails.Over25(TestNowUtc.Value);
            form.ApplicantDetails.PreviouslyLookedAfter = true;
            BestStartGrant.ShouldAskCareQuestion(form.ApplicantDetails).Should().BeFalse("question not relevant");

            Navigation.RequiresApplicantBenefits(form).Should().BeTrue("should still ask for benefits if not under 25 (despite previous care)");

            form.ApplicantDetails.Aged(TestNowUtc.Value, 23);
            form.ApplicantDetails.PreviouslyLookedAfter = false;
            BestStartGrant.ShouldAskCareQuestion(form.ApplicantDetails).Should().BeTrue("ensure question is asked");

            Navigation.RequiresApplicantBenefits(form).Should().BeTrue("should still ask for benefits if not previously in care");

            form.ApplicantDetails.Aged(TestNowUtc.Value, 23);
            form.ApplicantDetails.PreviouslyLookedAfter = true;
            BestStartGrant.ShouldAskCareQuestion(form.ApplicantDetails).Should().BeTrue("ensure question is asked");

            Navigation.RequiresApplicantBenefits(form).Should().BeFalse("should ask for guardian benefits if responded in full time education");
        }
コード例 #7
0
        public void StartingForm_SetsStartDate()
        {
            var next = BestStartGrant.Start();

            var form = Repository.Load <BestStartGrant>(next.Id);

            form.Started.Should().Be(TestNowUtc.Value);
        }
コード例 #8
0
 public override ApplicantDetailsConfig Find()
 {
     return(new ApplicantDetailsConfig
     {
         ShouldAskCareQuestion = BestStartGrant.ShouldAskCareQuestion(ApplicantDetails),
         ShouldAskEducationQuestion = BestStartGrant.ShouldAskEducationQuestion(ApplicantDetails),
         ShouldAskForNationalInsuranceNumber = BestStartGrant.ShouldAskForNationalInsuranceNumber(ApplicantDetails),
     });
 }
コード例 #9
0
 private void VerifyPaymentDetails(BestStartGrant doc)
 {
     doc.PaymentDetails.HasBankAccount.Should().BeTrue();
     doc.PaymentDetails.NameOfAccountHolder.Should().Be("system test account holder");
     doc.PaymentDetails.NameOfBank.Should().Be("system test bank name");
     doc.PaymentDetails.SortCode.Should().Be("01-02-03");
     doc.PaymentDetails.AccountNumber.Should().Be("01234567");
     doc.PaymentDetails.RollNumber.Should().Be("roll_number");
     _verifiedSections.Add(Sections.PaymentDetails);
 }
コード例 #10
0
 private void VerifyPartnerBenefits(BestStartGrant doc)
 {
     doc.PartnerBenefits.HasIncomeSupport.Should().BeTrue();
     doc.PartnerBenefits.HasIncomeBasedJobseekersAllowance.Should().BeTrue();
     doc.PartnerBenefits.HasIncomeRelatedEmplymentAndSupportAllowance.Should().BeTrue();
     doc.PartnerBenefits.HasUniversalCredit.Should().BeTrue();
     doc.PartnerBenefits.HasChildTaxCredit.Should().BeTrue();
     doc.PartnerBenefits.HasWorkingTextCredit.Should().BeTrue();
     doc.PartnerBenefits.HasHousingBenefit.Should().BeTrue();
     doc.PartnerBenefits.HasPensionCredit.Should().BeTrue();
     _verifiedSections.Add(Sections.PartnerBenefits);
 }
コード例 #11
0
        private void VerifyEvidence(BestStartGrant doc, string filename)
        {
            doc.Evidence.Files.Count.Should().Be(1);
            doc.Evidence.Files[0].Name.Should().Be(filename);

            var cloudStore    = DomainRegistry.CloudStore as LocalCloudStore;
            var storedContent = cloudStore.Retrieve("bsg-" + doc.Id, doc.Evidence.Files[0].CloudName);

            Encoding.ASCII.GetString(storedContent).Should().Be("some test content");

            doc.Evidence.SendingByPost.Should().BeTrue();
            _verifiedSections.Add(Sections.Evidence);
        }
コード例 #12
0
        public override bool Execute()
        {
            if (ExpectedChildren != null)
            {
                BestStartGrant.Validate(ExpectedChildren);
            }

            if (HealthProfessional != null)
            {
                BestStartGrant.Validate(HealthProfessional);
            }

            return(true);
        }
コード例 #13
0
        private void VerifyGuardianPartnerDetails(BestStartGrant doc, DateTime guardianPartnerDob)
        {
            doc.GuardianPartnerDetails.Title.Should().Be("gp.title");
            doc.GuardianPartnerDetails.FullName.Should().Be("gp.fullname");
            doc.GuardianPartnerDetails.DateOfBirth.Should().Be(guardianPartnerDob);
            doc.GuardianPartnerDetails.NationalInsuranceNumber.Should().Be("CD 23 45 67 E");
            doc.GuardianPartnerDetails.RelationshipToApplicant.Should().Be("gp.parent");

            doc.GuardianPartnerDetails.Address.Line1.Should().Be("gp.line1");
            doc.GuardianPartnerDetails.Address.Line2.Should().Be("gp.line2");
            doc.GuardianPartnerDetails.Address.Line3.Should().Be("gp.line3");
            doc.GuardianPartnerDetails.Address.Postcode.Should().Be("gp.postcode");
            _verifiedSections.Add(Sections.GuardianPartnerDetails);
        }
コード例 #14
0
        private void VerifyPartnerDetails(BestStartGrant doc, DateTime partnerDob)
        {
            doc.PartnerDetails.Title.Should().Be("p.title");
            doc.PartnerDetails.FullName.Should().Be("p.fullname");
            doc.PartnerDetails.DateOfBirth.Should().Be(partnerDob);
            doc.PartnerDetails.NationalInsuranceNumber.Should().Be("EF 23 45 67 G");

            doc.PartnerDetails.Address.Line1.Should().Be("p.line1");
            doc.PartnerDetails.Address.Line2.Should().Be("p.line2");
            doc.PartnerDetails.Address.Line3.Should().Be("p.line3");
            doc.PartnerDetails.Address.Postcode.Should().Be("p.postcode");

            _verifiedSections.Add(Sections.PartnerDetails);
        }
コード例 #15
0
 private void VerifyApplicantDetails(BestStartGrant doc, DateTime dob, bool?previouslyLookedAfter, bool?fullTimeEducation)
 {
     doc.ApplicantDetails.Title.Should().Be("system test Title");
     doc.ApplicantDetails.FirstName.Should().Be("system test FirstName");
     doc.ApplicantDetails.OtherNames.Should().Be("system test OtherNames");
     doc.ApplicantDetails.SurnameOrFamilyName.Should().Be("system test FamilyName");
     doc.ApplicantDetails.DateOfBirth.Should().Be(dob);
     doc.ApplicantDetails.PreviouslyLookedAfter.Should().Be(previouslyLookedAfter);
     doc.ApplicantDetails.FullTimeEducation.Should().Be(fullTimeEducation);
     doc.ApplicantDetails.NationalInsuranceNumber.Should().Be("AB 12 34 56 C");
     doc.ApplicantDetails.CurrentAddress.Line1.Should().Be("system test ca.line1");
     doc.ApplicantDetails.CurrentAddress.Line2.Should().Be("system test ca.line2");
     doc.ApplicantDetails.CurrentAddress.Line3.Should().Be("system test ca.line3");
     doc.ApplicantDetails.CurrentAddress.Postcode.Should().Be("system test ca.Postcode");
     doc.ApplicantDetails.EmailAddress.Should().Be("*****@*****.**");
     _verifiedSections.Add(Sections.ApplicantDetails);
 }
コード例 #16
0
        public void RequiresApplicantBenefits_NotRequiredWhenAskingGuardianBenefits()
        {
            var form = new BestStartGrantBuilder("form")
                       .With(f => f.ApplicantDetails, ApplicantDetailsBuilder.NewValid())
                       .Value();

            form.ApplicantDetails.Aged(TestNowUtc.Value, 18);
            form.ApplicantDetails.FullTimeEducation = false;
            BestStartGrant.ShouldAskEducationQuestion(form.ApplicantDetails).Should().BeTrue("ensure question is asked");

            Navigation.RequiresApplicantBenefits(form).Should().BeTrue("should ask for applicant benefits if not asking for guardian benefits");

            form.ApplicantDetails.Aged(TestNowUtc.Value, 19);
            form.ApplicantDetails.FullTimeEducation = true;
            BestStartGrant.ShouldAskEducationQuestion(form.ApplicantDetails).Should().BeTrue("ensure question is asked");

            Navigation.RequiresApplicantBenefits(form).Should().BeFalse("should not ask for applicant benefits if asking for guardian benefits");
        }
        public void ApplicantDetails_RequiresNationalInsuranceNumber()
        {
            TestNowUtc = new DateTime(2009, 08, 07, 06, 05, 04);
            var applicantDetails = ApplicantDetailsBuilder.NewValid();

            BestStartGrant.ShouldAskForNationalInsuranceNumber(applicantDetails).Should().BeTrue("default builder should ask question");

            applicantDetails.DateOfBirth = null;
            BestStartGrant.ShouldAskForNationalInsuranceNumber(applicantDetails).Should().BeTrue("should ask by default");

            // applicant is 16 today
            applicantDetails.DateOfBirth = new DateTime(1993, 08, 07);
            BestStartGrant.ShouldAskForNationalInsuranceNumber(applicantDetails).Should().BeTrue("ask for NINO if >= 16");

            // applicant is 16 tomorrow (still 15)
            applicantDetails.DateOfBirth = new DateTime(1993, 08, 08);
            BestStartGrant.ShouldAskForNationalInsuranceNumber(applicantDetails).Should().BeFalse("under 16 does not have NINO");
        }
コード例 #18
0
        private void VerifyExistingChildren(BestStartGrant doc)
        {
            doc.ExistingChildren.AnyExistingChildren.Should().BeTrue();
            doc.ExistingChildren.Children.Count.Should().Be(2);

            doc.ExistingChildren.Children[0].FirstName.Should().Be("c1 first name");
            doc.ExistingChildren.Children[0].Surname.Should().Be("c1 last name");
            doc.ExistingChildren.Children[0].DateOfBirth.Should().Be(new DateTime(2003, 02, 01));
            doc.ExistingChildren.Children[0].Relationship.Should().Be(Relationship.Parent);
            doc.ExistingChildren.Children[0].ChildBenefit.Should().BeTrue();

            doc.ExistingChildren.Children[1].FirstName.Should().Be("c2 first name");
            doc.ExistingChildren.Children[1].Surname.Should().Be("c2 last name");
            doc.ExistingChildren.Children[1].DateOfBirth.Should().Be(new DateTime(2004, 03, 02));
            doc.ExistingChildren.Children[1].Relationship.Should().Be(Relationship.KinshipCarer);
            doc.ExistingChildren.Children[1].ChildBenefit.Should().BeFalse();
            doc.ExistingChildren.Children[1].NoChildBenefitReason.Should().Be("reason text");
            _verifiedSections.Add(Sections.ExistingChildren);
        }
コード例 #19
0
        public static Evidence AddFiles(this Evidence evidence, BestStartGrant form, int count)
        {
            var cloudStore    = DomainRegistry.CloudStore as LocalCloudStore;
            var existingFiles = cloudStore.List("bsg-" + form.Id);

            for (int i = 0; i < count; i++)
            {
                var fileName  = $"evidence{i + 1}.txt";
                var cloudName = $"cloud{i}.txt";

                if (!existingFiles.Contains(cloudName))
                {
                    cloudStore.Store("bsg-" + form.Id, cloudName, fileName, Encoding.ASCII.GetBytes($"file content {i}"));
                }

                evidence.Files.Add(new EvidenceFile {
                    Name = fileName, CloudName = cloudName
                });
            }

            return(evidence);
        }
コード例 #20
0
 public override NextSection Execute()
 {
     return(BestStartGrant.Start());
 }
 protected void ExistingChildrenShouldBeInvalid(BestStartGrant form, Action <ExistingChildren> mutator)
 {
     ShouldBeInvalid(() => form.AddExistingChildren(ExistingChildrenBuilder.NewValid(2, mutator)));
 }
 protected void ApplicantDetailsShouldBeInvalid(BestStartGrant form, Action <ApplicantDetails> mutator)
 {
     ShouldBeInvalid(() => form.AddApplicantDetails(ApplicantDetailsBuilder.NewValid(mutator)));
 }
 protected void ApplicantBenefitsShouldBeInvalid(BestStartGrant form, Action <Benefits> mutator)
 {
     ShouldBeInvalid(() => form.AddApplicantBenefits(BenefitsBuilder.NewWithBenefit(mutator)));
 }
 protected void GuardianPartnerDetailsShouldBeInvalid(BestStartGrant form, Action <RelationDetails> mutator)
 {
     ShouldBeInvalid(() => form.AddGuardianPartnerDetails(RelationDetailsBuilder.NewValid(mutator)));
 }
コード例 #25
0
 protected void EvidenceShouldBeValid(BestStartGrant form, Action <Evidence> mutator)
 {
     Builder.Modify(form).With(f => f.Evidence, null);
     ShouldBeValid(() => form.AddEvidence(EvidenceBuilder.NewValid(mutator)));
 }
コード例 #26
0
 protected void ConsentShouldBeInvalid(BestStartGrant form, Action <Consent> mutator)
 {
     ShouldBeInvalid(() => form.AddConsent(ConsentBuilder.NewValid(mutator)));
 }
コード例 #27
0
 public override BsgDetail Find()
 {
     return(BestStartGrant.FindLatest(UserId));
 }
 protected void HealthProfessionalShouldBeInvalid(BestStartGrant form, Action <HealthProfessional> mutator)
 {
     ShouldBeInvalid(() => form.AddHealthProfessional(HealthProfessionalBuilder.NewValid(mutator)));
 }
 protected void GuardianPartnerBenefitsShouldBeInvalid(BestStartGrant form, Action <Benefits> mutator)
 {
     ShouldBeInvalid(() => form.AddGuardianPartnerBenefits(BenefitsBuilder.NewWithBenefit(mutator)));
 }
コード例 #30
0
 protected void DeclarationShouldBeInvalid(BestStartGrant form, Action <Declaration> mutator)
 {
     ShouldBeInvalid(() => form.AddDeclaration(DeclarationBuilder.NewValid(mutator)));
 }