public void Declaration_POST_CompletesForm()
        {
            WebAppTest(client =>
            {
                // the declaration form is now dependent on a completed ApplicantDetails, so...
                var detail = NewBsgDetail("form123");
                ExecutorStub.SetupQuery(It.IsAny<FindBsgSection>(), detail);
                ExecutorStub.SetupCommand(It.IsAny<AddDeclaration>(), new NextSection { Type = NextType.Complete });

                var response = client.Get(BsgActions.Declaration(detail.Id)).Form<Declaration>(1)
                    .SelectConfirm(m => m.AgreedToLegalStatement, true)
                    .Submit(client);

                ExecutorStub.Executed<AddDeclaration>(0).ShouldBeEquivalentTo(new AddDeclaration
                {
                    FormId = "form123",
                    Declaration = new Declaration
                    {
                        AgreedToLegalStatement = true,
                    },
                });

                response.ActionResultOf<RedirectResult>().Url.Should().Be(BsgActions.Complete());
            });
        }
示例#2
0
        public void HealthProfessional_POST_ErrorsAreDisplayed()
        {
            WebAppTest(client =>
            {
                ExecutorStub.SetupCommand <AddHealthProfessional, NextSection>((cmd, def) => { throw new DomainException("simulated logic error"); });

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

                response.Doc.Find(".validation-summary-errors").Should().NotBeNull();
            });
        }
示例#3
0
        public void ApplicantBenefits_POST_ErrorsAreDisplayed()
        {
            WebAppTest(client =>
            {
                ExecutorStub.SetupCommand <AddApplicantBenefits, NextSection>((cmd, def) => { throw new DomainException("simulated logic error"); });

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

                response.Doc.Find(".validation-summary-errors").Should().NotBeNull();
            });
        }
        public void NextSection_RedirectToNextSection()
        {
            WebAppTest(client =>
            {
                ExecutorStub.SetupCommand(It.IsAny <AddApplicantDetails>(), new NextSection {
                    Type = NextType.Section, Id = "form123", Section = Sections.ExistingChildren
                });

                var response = client.Get(BsgActions.ApplicantDetails("form123")).Form <ApplicantDetails>(1).Submit(client);

                response.ActionResultOf <RedirectResult>().Url.Should().Be(BsgActions.ExistingChildren("form123"));
            });
        }
        public void Declaration_POST_ErrorsAreDisplayed()
        {
            WebAppTest(client =>
            {
                // the declaration form is now dependent on a completed ApplicantDetails, so...
                // even if the form is not queried such as this test, the browser cannot render the page without ApplicantDetails
                var detail = NewBsgDetail("form123");
                ExecutorStub.SetupQuery(It.IsAny<FindBsgSection>(), detail);
                ExecutorStub.SetupCommand<AddDeclaration, NextSection>((cmd, def) => { throw new DomainException("simulated logic error"); });

                var response = client.Get(BsgActions.Declaration(detail.Id)).Form<Declaration>(1)
                    .SubmitName("", client, r => r.SetExpectedResponse(HttpStatusCode.OK));

                response.Doc.Find(".validation-summary-errors").Should().NotBeNull();
            });
        }
        public void BeforeYouApply_POST_StartsForm()
        {
            WebAppTest(client =>
            {
                ExecutorStub.SetupCommand(It.IsAny <StartBestStartGrant>(), new NextSection
                {
                    Id      = "form123",
                    Section = Sections.Consent,
                });

                var response = client.Get(BsgActions.BeforeYouApply()).Form <object>(1)
                               .Submit(client);

                ExecutorStub.Executed <StartBestStartGrant>().Length.Should().Be(1);

                response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace();
            });
        }
        public void Overview_POST_StartsForm()
        {
            WebAppTest(client =>
            {
                ExecutorStub.SetupCommand(It.IsAny <StartChangeOfCircs>(), new NextSection
                {
                    Id      = "form123",
                    Section = Sections.Consent,
                });

                var response = client.Get(HomeActions.Index()).Form <object>(1)
                               .Submit(client);

                ExecutorStub.Executed <StartChangeOfCircs>().Length.Should().Be(1);

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