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