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

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

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

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

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

                ExecutorStub.Executed <AddConsent>(0).ShouldBeEquivalentTo(new AddConsent
                {
                    FormId  = "form123",
                    Consent = new Consent {
                        AgreedToConsent = true
                    },
                });

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