Пример #1
0
        public void ExpectedChildren_DoesNotAskForDetails_WhenNoBabyDue()
        {
            WebAppTest(client =>
            {
                var response = client.Get(BsgActions.ExpectedChildren("form"));
                var form     = response.Form <ExpectedChildren>(1);

                form.RadioShows(m => m.IsBabyExpected, true, "due-details");
            });
        }
Пример #2
0
        public void ExpectedChildren_DoesNotAskForCount_WhenNotMoreThanOneChild()
        {
            WebAppTest(client =>
            {
                var response = client.Get(BsgActions.ExpectedChildren("form"));
                var form     = response.Form <ExpectedChildren>(1);

                form.RadioShows(m => m.IsMoreThan1BabyExpected, true, "baby-count");
            });
        }
Пример #3
0
        public void ExpectedChildren_POST_ErrorsAreDisplayed()
        {
            WebAppTest(client =>
            {
                ExecutorStub.SetupCommand <AddExpectedChildren, NextSection>((cmd, def) => { throw new DomainException("simulated logic error"); });

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

                response.Doc.Find(".validation-summary-errors").Should().NotBeNull();
            });
        }
Пример #4
0
        public void ExpectedChildren_GET_PopulatesExistingDetails()
        {
            WebAppTest(client =>
            {
                var detail = NewBsgDetail("form123");
                ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail);

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

                ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection {
                    FormId = detail.Id, Section = Sections.ExpectedChildren
                });
                response.Doc.Form <ExpectedChildren>(1).GetText(m => m.ExpectedBabyCount).Should().Be(detail.ExpectedChildren.ExpectedBabyCount.ToString());
            });
        }
Пример #5
0
        public void ExpectedChildren_POST_StoresData()
        {
            WebAppTest(client =>
            {
                var response = client.Get(BsgActions.ExpectedChildren("form123")).Form <ExpectedChildren>(1)
                               .SetDate(m => m.ExpectancyDate, "01", "02", "2003")
                               .SetText(m => m.ExpectedBabyCount, "2")
                               .Submit(client);

                ExecutorStub.Executed <AddExpectedChildren>(0).ShouldBeEquivalentTo(new AddExpectedChildren
                {
                    FormId           = "form123",
                    ExpectedChildren = new ExpectedChildren
                    {
                        ExpectancyDate    = new DateTime(2003, 02, 01),
                        ExpectedBabyCount = 2,
                    },
                });

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