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()); }); }
public void Evidence_POST_RemoveFile() { WebAppTest(client => { // prep this test by adding a file to remove var cloudName = System.Guid.NewGuid().ToString(); var detail = NewBsgDetail("form123"); detail.Evidence.Files.Add(new EvidenceFile { Name = "UploadedFile.pdf", CloudName = cloudName }); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); // now remove it var response = client.Get(BsgActions.Evidence(detail.Id)) .Form <EvidenceFile>(1) .SubmitName(BsgButtons.RemoveFile, client); ExecutorStub.Executed <RemoveEvidenceFile>(0).ShouldBeEquivalentTo(new RemoveEvidenceFile { FormId = detail.Id, CloudName = cloudName, }); response.ActionResultOf <RedirectResult>().Url.Should().Be(BsgActions.Evidence(detail.Id)); }); }
public void PaymentDetails_POST_StoresData() { WebAppTest(client => { var response = client.Get(BsgActions.PaymentDetails("form123")).Form <PaymentDetails>(1) .SelectYes(m => m.HasBankAccount) .SetText(m => m.NameOfAccountHolder, "test name") .SetText(m => m.NameOfBank, "test bank") .SetText(m => m.SortCode, "01-02-03") .SetText(m => m.AccountNumber, "01234567") .SetText(m => m.RollNumber, "roll/number") .Submit(client); ExecutorStub.Executed <AddPaymentDetails>(0).ShouldBeEquivalentTo(new AddPaymentDetails { FormId = "form123", PaymentDetails = new PaymentDetails { HasBankAccount = true, NameOfAccountHolder = "test name", NameOfBank = "test bank", SortCode = "01-02-03", AccountNumber = "01234567", RollNumber = "roll/number", }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void PartnerDetails_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.PartnerDetails(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.PartnerDetails }); var form = response.Doc.Form <RelationDetails>(1); form.GetText(m => m.Title).Should().Be(detail.PartnerDetails.Title); form.Get(m => m.RelationshipToApplicant).Length.Should().Be(0, "Should not ask partner's relationship"); form.GetText(m => m.Address.Line1).Should().Be(detail.PartnerDetails.Address.Line1); form.Get(m => m.InheritAddress).Length.Should().Be(1, "option to inherit address should be visible"); form.WhenCheckedShows(m => m.InheritAddress, "inherited-address"); form.WhenUncheckedShows(m => m.InheritAddress, "new-address"); }); }
public void Declaration_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny<FindBsgSection>(), detail); var response = client.Get(BsgActions.Declaration(detail.Id)); ExecutorStub.Executed<FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.Declaration }); response.Doc.Form<Declaration>(1).GetConfirm(m => m.AgreedToLegalStatement).Should().Be(detail.Declaration.AgreedToLegalStatement); }); }
public void ExistingChildren_POST_StoresData() { WebAppTest(client => { var response = client.Get(BsgActions.ExistingChildren("form123")).Form <ExistingChildren>(1) .SelectYes(m => m.AnyExistingChildren) .SetText(m => m.Children[0].FirstName, "child 0 first name") .SetText(m => m.Children[0].Surname, "child 0 surname") .SetDate(m => m.Children[0].DateOfBirth, "03", "04", "2005") .SetText(m => m.Children[0].Relationship, Relationship.KinshipCarer.ToString()) .SelectYes(m => m.Children[0].ChildBenefit) .SubmitName(BsgButtons.AddChild, client, r => r.SetExpectedResponse(HttpStatusCode.OK)).Form <ExistingChildren>(1) // add a second child .SetText(m => m.Children[1].FirstName, "child 1 first name") .SetText(m => m.Children[1].Surname, "child 1 surname") .SetDate(m => m.Children[1].DateOfBirth, "02", "03", "2004") .SetText(m => m.Children[1].Relationship, Relationship.Parent.ToString()) // leave child benefit as null/empty .SubmitName("", client); ExecutorStub.Executed <AddExistingChildren>(0).ShouldBeEquivalentTo(new AddExistingChildren { FormId = "form123", ExistingChildren = new ExistingChildren { AnyExistingChildren = true, Children = new List <ExistingChild>() { new ExistingChild { FirstName = "child 0 first name", Surname = "child 0 surname", DateOfBirth = new DateTime(2005, 04, 03), Relationship = Relationship.KinshipCarer, ChildBenefit = true, }, new ExistingChild { FirstName = "child 1 first name", Surname = "child 1 surname", DateOfBirth = new DateTime(2004, 03, 02), Relationship = Relationship.Parent, ChildBenefit = null, }, }, }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
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()); }); }
public void PaymentDetails_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.PaymentDetails(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.PaymentDetails }); response.Doc.Form <PaymentDetails>(1).GetText(m => m.NameOfAccountHolder).Should().Be(detail.PaymentDetails.NameOfAccountHolder); }); }
public void GuardianDetails_GET_PopulatesExistingAddressDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.GuardianDetails(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.GuardianDetails }); response.Doc.Form <RelationDetails>(1).GetText(m => m.Address.Line1).Should().Be(detail.GuardianDetails.Address.Line1); }); }
public void ApplicantDetails_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewCocDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindCocSection>(), detail); var response = client.Get(CocActions.ApplicantDetails(detail.Id)); ExecutorStub.Executed <FindCocSection>(0).ShouldBeEquivalentTo(new FindCocSection { FormId = detail.Id, Section = Sections.ApplicantDetails }); response.Doc.Form <ApplicantDetails>(1).GetText(m => m.FullName).Should().Be(detail.ApplicantDetails.FullName); }); }
public void ApplicantBenefits_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.ApplicantBenefits(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.ApplicantBenefits }); response.Doc.Form <Benefits>(1).GetConfirm(m => m.HasIncomeSupport).Should().Be(detail.ApplicantBenefits.HasIncomeSupport); }); }
public void HealthProfessional_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewCocDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindCocSection>(), detail); var response = client.Get(CocActions.HealthProfessional(detail.Id)); ExecutorStub.Executed <FindCocSection>(0).ShouldBeEquivalentTo(new FindCocSection { FormId = detail.Id, Section = Sections.HealthProfessional }); response.Doc.Form <HealthProfessional>(1).GetText(m => m.Pin).Should().Be(detail.HealthProfessional.Pin); }); }
public void Identity_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewCocDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindCocSection>(), detail); var response = client.Get(CocActions.Identity(detail.Id)); ExecutorStub.Executed <FindCocSection>(0).ShouldBeEquivalentTo(new FindCocSection { FormId = detail.Id, Section = Sections.Identity }); response.Doc.Form <IdentityModel>(1).GetText(m => m.Email).Should().Be(detail.Identity); }); }
public void Options_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewCocDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindCocSection>(), detail); var response = client.Get(CocActions.Options(detail.Id)); ExecutorStub.Executed <FindCocSection>(0).ShouldBeEquivalentTo(new FindCocSection { FormId = detail.Id, Section = Sections.Options }); response.Doc.Form <Options>(1).GetConfirm(m => m.ChangePersonalDetails).Should().Be(detail.Options.ChangePersonalDetails); }); }
public void Evidence_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.Evidence(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.Evidence }); response.Doc.Form <Evidence>(1).GetConfirm(m => m.SendingByPost).Should().Be(detail.Evidence.SendingByPost); response.Doc.Document.Body.TextContent.Should().Contain("No files uploaded"); }); }
public void Identity_POST_PopulatesIdentity() { WebAppTest(client => { var response = client.Get(CocActions.Identity("form123")).Form <IdentityModel>(1) .SetText(m => m.Email, "*****@*****.**") .Submit(client); ExecutorStub.Executed <AddIdentity>(0).ShouldBeEquivalentTo(new AddIdentity { FormId = "form123", Identity = "*****@*****.**", }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
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(); }); }
public void HealthProfessional_POST_PopulatesHealthProfessional() { WebAppTest(client => { var response = client.Get(CocActions.HealthProfessional("form123")).Form <HealthProfessional>(1) .SetText(m => m.Pin, "test pin") .Submit(client); ExecutorStub.Executed <AddHealthProfessional>(0).ShouldBeEquivalentTo(new AddHealthProfessional { FormId = "form123", HealthProfessional = new HealthProfessional { Pin = "test pin" }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
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(); }); }
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(); }); }
public void ApplicantDetails_POST_PopulatesApplicantDetails() { WebAppTest(client => { var response = client.Get(CocActions.ApplicantDetails("form123")).Form <ApplicantDetails>(1) .SetText(m => m.FullName, "test full name") .Submit(client); ExecutorStub.Executed <AddApplicantDetails>(0).ShouldBeEquivalentTo(new AddApplicantDetails { FormId = "form123", ApplicantDetails = new ApplicantDetails { FullName = "test full name" }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void Options_POST_PopulatesOptions() { WebAppTest(client => { var response = client.Get(CocActions.Options("form123")).Form <Options>(1) .SelectConfirm(m => m.ChangePersonalDetails, true) .Submit(client); ExecutorStub.Executed <AddOptions>(0).ShouldBeEquivalentTo(new AddOptions { FormId = "form123", Options = new Options { ChangePersonalDetails = true }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void Evidence_POST_PopulatesEvidence() { WebAppTest(client => { var response = client.Get(BsgActions.Evidence("form123")).Form <Evidence>(1) .SelectConfirm(m => m.SendingByPost, true) .SubmitName("", client); ExecutorStub.Executed <AddEvidence>(0).ShouldBeEquivalentTo(new AddEvidence { FormId = "form123", Evidence = new Evidence { SendingByPost = true }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void ExpectedChildren_POST_PopulatesExpectedChildren() { WebAppTest(client => { var response = client.Get(CocActions.ExpectedChildren("form123")).Form <ExpectedChildren>(1) .SetText(m => m.ExpectedBabyCount, "2") .Submit(client); ExecutorStub.Executed <AddExpectedChildren>(0).ShouldBeEquivalentTo(new AddExpectedChildren { FormId = "form123", ExpectedChildren = new ExpectedChildren { IsBabyExpected = true, ExpectedBabyCount = 2 }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void ApplicantBenefits_POST_CanAddApplicantBenefits() { WebAppTest(client => { var response = client.Get(BsgActions.ApplicantBenefits("form123")).Form <Benefits>(1) .SelectConfirm(m => m.HasIncomeSupport, true) .Submit(client); ExecutorStub.Executed <AddApplicantBenefits>(0).ShouldBeEquivalentTo(new AddApplicantBenefits { FormId = "form123", ApplicantBenefits = new Benefits { HasIncomeSupport = true, }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void GuardianDetails_POST_CanAddGuardianDetails() { WebAppTest(client => { var response = client.Get(BsgActions.GuardianDetails("form123")).Form <RelationDetails>(1) .SetText(m => m.Title, "test title") .Submit(client); ExecutorStub.Executed <AddGuardianDetails>(0).ShouldBeEquivalentTo(new AddGuardianDetails { FormId = "form123", GuardianDetails = new RelationDetails { Title = "test title", }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void Evidence_POST_UploadFile() { WebAppTest(client => { var response = client.Get(BsgActions.Evidence("form123")); response = response.Form <Evidence>(1) .AddFile("UploadedFile.pdf", Encoding.ASCII.GetBytes("uploaded content")) .SubmitName(BsgButtons.UploadFile, client); ExecutorStub.Executed <AddEvidenceFile>(0).ShouldBeEquivalentTo(new AddEvidenceFile { FormId = "form123", Filename = "UploadedFile.pdf", Content = Encoding.ASCII.GetBytes("uploaded content"), }); response.ActionResultOf <RedirectResult>().Url.Should().Be(BsgActions.Evidence("form123")); }); }
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(); }); }
public void PartnerDetails_POST_CanAddPartnerAddressDetails() { WebAppTest(client => { var response = client.Get(BsgActions.PartnerDetails("form123")).Form <RelationDetails>(1) .SetText(m => m.Address.Line1, "line 1") .Submit(client); ExecutorStub.Executed <AddPartnerDetails>(0).ShouldBeEquivalentTo(new AddPartnerDetails { FormId = "form123", PartnerDetails = new RelationDetails { Address = new Address { Line1 = "line 1" }, }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }