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

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

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

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

                ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection {
                    FormId = detail.Id, Section = Sections.GuardianPartnerDetails
                });
                response.Doc.Form <RelationDetails>(1).GetText(m => m.Address.Line1).Should().Be(detail.GuardianPartnerDetails.Address.Line1);
            });
        }
Beispiel #3
0
        public void GuardianPartnerDetails_POST_CanAddGuardianPartnerDetails()
        {
            WebAppTest(client =>
            {
                var response = client.Get(BsgActions.GuardianPartnerDetails("form123")).Form <RelationDetails>(1)
                               .SetText(m => m.Title, "test title")
                               .Submit(client);

                ExecutorStub.Executed <AddGuardianPartnerDetails>(0).ShouldBeEquivalentTo(new AddGuardianPartnerDetails
                {
                    FormId = "form123",
                    GuardianPartnerDetails = new RelationDetails
                    {
                        Title = "test title",
                    },
                });

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