public void PaymentDetails_POST_ErrorsAreDisplayed() { WebAppTest(client => { ExecutorStub.SetupCommand <AddPaymentDetails, NextSection>((cmd, def) => { throw new DomainException("simulated logic error"); }); var response = client.Get(CocActions.PaymentDetails("form123")).Form <PaymentDetails>(1) .Submit(client, r => r.SetExpectedResponse(HttpStatusCode.OK)); response.Doc.Find(".validation-summary-errors").Should().NotBeNull(); }); }
public void PaymentDetails_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewCocDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindCocSection>(), detail); var response = client.Get(CocActions.PaymentDetails(detail.Id)); ExecutorStub.Executed <FindCocSection>(0).ShouldBeEquivalentTo(new FindCocSection { FormId = detail.Id, Section = Sections.PaymentDetails }); response.Doc.Form <PaymentDetails>(1).GetText(m => m.NameOfAccountHolder).Should().Be(detail.PaymentDetails.NameOfAccountHolder); }); }
public void PaymentDetails_POST_PopulatesPaymentDetails() { WebAppTest(client => { var response = client.Get(CocActions.PaymentDetails("form123")).Form <PaymentDetails>(1) .SetText(m => m.NameOfAccountHolder, "test full name") .Submit(client); ExecutorStub.Executed <AddPaymentDetails>(0).ShouldBeEquivalentTo(new AddPaymentDetails { FormId = "form123", PaymentDetails = new PaymentDetails { NameOfAccountHolder = "test full name" }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }