public void PartnerBenefits_POST_ErrorsAreDisplayed() { WebAppTest(client => { ExecutorStub.SetupCommand <AddPartnerBenefits, NextSection>((cmd, def) => { throw new DomainException("simulated logic error"); }); var response = client.Get(BsgActions.PartnerBenefits("form123")).Form <Benefits>(1) .SubmitName("", client, r => r.SetExpectedResponse(HttpStatusCode.OK)); response.Doc.Find(".validation-summary-errors").Should().NotBeNull(); }); }
public void PartnerBenefits_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.PartnerBenefits(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.PartnerBenefits }); response.Doc.Form <Benefits>(1).GetConfirm(m => m.HasIncomeSupport).Should().Be(detail.PartnerBenefits.HasIncomeSupport); }); }
public void PartnerBenefits_POST_CanAddApplicantBenefits() { WebAppTest(client => { var response = client.Get(BsgActions.PartnerBenefits("form123")).Form <Benefits>(1) .SelectConfirm(m => m.HasIncomeSupport, true) .Submit(client); ExecutorStub.Executed <AddPartnerBenefits>(0).ShouldBeEquivalentTo(new AddPartnerBenefits { FormId = "form123", PartnerBenefits = new Benefits { HasIncomeSupport = true, }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }