Beispiel #1
0
        public void ApplicantBenefits_POST_ErrorsAreDisplayed()
        {
            WebAppTest(client =>
            {
                ExecutorStub.SetupCommand <AddApplicantBenefits, NextSection>((cmd, def) => { throw new DomainException("simulated logic error"); });

                var response = client.Get(BsgActions.ApplicantBenefits("form123")).Form <Benefits>(1)
                               .SubmitName("", client, r => r.SetExpectedResponse(HttpStatusCode.OK));

                response.Doc.Find(".validation-summary-errors").Should().NotBeNull();
            });
        }
Beispiel #2
0
        public void ApplicantBenefits_GET_PopulatesExistingDetails()
        {
            WebAppTest(client =>
            {
                var detail = NewBsgDetail("form123");
                ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail);

                var response = client.Get(BsgActions.ApplicantBenefits(detail.Id));

                ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection {
                    FormId = detail.Id, Section = Sections.ApplicantBenefits
                });
                response.Doc.Form <Benefits>(1).GetConfirm(m => m.HasIncomeSupport).Should().Be(detail.ApplicantBenefits.HasIncomeSupport);
            });
        }
Beispiel #3
0
        public void ApplicantBenefits_POST_CanAddApplicantBenefits()
        {
            WebAppTest(client =>
            {
                var response = client.Get(BsgActions.ApplicantBenefits("form123")).Form <Benefits>(1)
                               .SelectConfirm(m => m.HasIncomeSupport, true)
                               .Submit(client);

                ExecutorStub.Executed <AddApplicantBenefits>(0).ShouldBeEquivalentTo(new AddApplicantBenefits
                {
                    FormId            = "form123",
                    ApplicantBenefits = new Benefits
                    {
                        HasIncomeSupport = true,
                    },
                });

                response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace();
            });
        }