public void AddIdentity_Throws_WhenNoExistingFormForIdentity()
        {
            var coc = new ChangeOfCircsBuilder("form").Insert();

            Assert.Throws <DomainException>(() =>
                                            coc.AddIdentity("*****@*****.**"));
        }
        public void Declaration_Validation()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            DeclarationShouldBeValid(form, m => { });

            DeclarationShouldBeInvalid(form, m => m.AgreedToLegalStatement = false);
        }
Exemple #3
0
        public void Consent_Validation()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            ConsentShouldBeValid(form, m => { });

            ConsentShouldBeInvalid(form, m => m.AgreedToConsent = false);
        }
        public void HealthProfessional_Validation()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            HealthProfessionalShouldBeValid(form, m => { });

            HealthProfessionalShouldBeInvalid(form, m => m.Pin = null);
        }
Exemple #5
0
        public void ExpectedChildren_Validation()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            ExpectedChildrenShouldBeValid(form, m => { });

            ExpectedChildrenShouldBeInvalid(form, m => m.IsBabyExpected = false);
            ExpectedChildrenShouldBeInvalid(form, m => m.IsBabyExpected = null);
        }
        public void Identity_Validation()
        {
            new BestStartGrantBuilder("form").PreviousApplicationFor("*****@*****.**").Insert();
            var form = new ChangeOfCircsBuilder("form").Insert();

            IdentityShouldBeValid(form, "*****@*****.**");

            IdentityShouldBeInvalid(form, null);
            IdentityShouldBeInvalid(form, "");
        }
Exemple #7
0
        public void PaymentDetails_Validation()
        {
            var form = new ChangeOfCircsBuilder("form")
                       .With(f => f.ExistingPaymentDetails, PaymentDetailsBuilder.NewValid())
                       .Insert();

            PaymentDetailsShouldBeValid(form, m => { });

            PaymentDetailsShouldBeInvalid(form, m => m.AccountNumber = null); // only need to check existing BankDetails validation called
        }
Exemple #8
0
        public void PaymentDetails_WhenNoExistingBankAccount_MustAddBankAccount()
        {
            var form = new ChangeOfCircsBuilder("form")
                       .WithCompletedSections(markAsCompleted: false)
                       .Insert(coc => coc.ExistingPaymentDetails.WithoutAccount());

            ShouldBeInvalid(() =>
                            form.AddPaymentDetails(new PaymentDetails {
                HasBankAccount = false
            }));
        }
Exemple #9
0
        public void Evidence_Validation()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            EvidenceShouldBeValid(form, m => { });
            EvidenceShouldBeValid(form, m => { m.SendingByPost = true; m.Files = new List <EvidenceFile>(); });
            EvidenceShouldBeValid(form, m => { m.SendingByPost = false; m.Files = new List <EvidenceFile> {
                                                   new EvidenceFile()
                                               }; });

            EvidenceShouldBeInvalid(form, m => { m.SendingByPost = false; m.Files = new List <EvidenceFile>(); });
        }
        public void Complete_SetsCompletionDate()
        {
            var form = new ChangeOfCircsBuilder("form")
                       .WithCompletedSections(markAsCompleted: false)
                       .With(f => f.Declaration, null)
                       .Insert();

            var next = form.AddDeclaration(DeclarationBuilder.NewValid());

            next.Section.Should().BeNull("this should be the last section that is filled out");
            form.Completed.Should().Be(TestNowUtc.Value);
        }
        public void RequiresPaymentDetails()
        {
            var form = new ChangeOfCircsBuilder("form")
                       .With(f => f.Options, OptionsBuilder.NewValid())
                       .Value();

            form.Options.ChangePaymentDetails = false;

            Navigation.RequiresPaymentDetails(form).Should().BeFalse();

            form.Options.ChangePaymentDetails = true;

            Navigation.RequiresPaymentDetails(form).Should().BeTrue();
        }
        public void Options_Validation()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            OptionsShouldBeValid(form, m => { });
            OptionsShouldBeValid(form, m => { m.Other = false; m.OtherDetails = null; });

            OptionsShouldBeInvalid(form, m => m.AllUnselected());
            OptionsShouldBeInvalid(form, m => { m.Other = true; m.OtherDetails = null; });

            // until the following sections are implemented, they are invalid selections
            OptionsShouldBeInvalid(form, m => m.ChangePartnerDetails  = true);
            OptionsShouldBeInvalid(form, m => m.ChangeChildrenDetails = true);
        }
        public void RequiresHealthProfessional()
        {
            var form = new ChangeOfCircsBuilder("form")
                       .With(f => f.Options, OptionsBuilder.NewValid())
                       .Value();

            form.Options.AddExpectedBaby = false;

            Navigation.RequiresHealthProfessional(form).Should().BeFalse();

            form.Options.AddExpectedBaby = true;

            Navigation.RequiresHealthProfessional(form).Should().BeTrue();
        }
Exemple #14
0
        public void ApplicantDetails_Validation()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            ApplicantDetailsShouldBeValid(form, m => { });
            ApplicantDetailsShouldBeValid(form, m => m.Title             = null);
            ApplicantDetailsShouldBeValid(form, m => m.Address.Line2     = null);
            ApplicantDetailsShouldBeValid(form, m => m.Address.Line3     = null);
            ApplicantDetailsShouldBeValid(form, m => m.MobilePhoneNumber = null);
            ApplicantDetailsShouldBeValid(form, m => m.HomePhoneNumer    = null);
            ApplicantDetailsShouldBeValid(form, m => m.EmailAddress      = null);

            ApplicantDetailsShouldBeInvalid(form, m => m.FullName         = null);
            ApplicantDetailsShouldBeInvalid(form, m => m.Address.Line1    = null);
            ApplicantDetailsShouldBeInvalid(form, m => m.Address.Postcode = null);
        }
Exemple #15
0
        public void AddEvidenceFile()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            var fileBytes = Encoding.ASCII.GetBytes("some content");

            form.AddEvidenceFile("FileName1.txt", fileBytes);

            var storedForm = Repository.Load <ChangeOfCircs>(form.Id);

            storedForm.Evidence.Files.Count.Should().Be(1);

            var file = storedForm.Evidence.Files[0];

            file.Name.Should().Be("FileName1.txt");

            CloudStore.List("coc-" + form.Id).Should().Contain(file.CloudName);
        }
Exemple #16
0
        public void AddEvidenceFile_HandlesTwoFilesWithSameName()
        {
            var form = new ChangeOfCircsBuilder("form").Insert();

            var fileBytes = Encoding.ASCII.GetBytes("filename.txt content");

            form.AddEvidenceFile("filename", fileBytes);
            form.AddEvidenceFile("filename", fileBytes);

            var storedForm = Repository.Load <ChangeOfCircs>(form.Id);

            storedForm.Evidence.Files.Count.Should().Be(2);

            storedForm.Evidence.Files[0].Name.Should().Be("filename");
            storedForm.Evidence.Files[1].Name.Should().Be("filename");

            storedForm.Evidence.Files[0].CloudName.Should().NotBe(storedForm.Evidence.Files[1].CloudName, "cloud names should be unique");

            CloudStore.List("coc-form").Should().Contain(storedForm.Evidence.Files[0].CloudName);
            CloudStore.List("coc-form").Should().Contain(storedForm.Evidence.Files[1].CloudName);
        }
        public void AddIdentity_StoresBsgDetail()
        {
            var existingForm = new BestStartGrantBuilder("existing_form")
                               .WithCompletedSections()
                               .With(f => f.UserId, "*****@*****.**")
                               .Insert(f =>
            {
                f.ApplicantDetails.Title                = "tst_title";
                f.ApplicantDetails.FirstName            = "tst_fn";
                f.ApplicantDetails.OtherNames           = "tst_on";
                f.ApplicantDetails.SurnameOrFamilyName  = "tst_sn";
                f.ApplicantDetails.CurrentAddress.Line1 = "al1";
                f.ApplicantDetails.MobilePhoneNumber    = "123";
                f.ApplicantDetails.PhoneNumer           = "234";
                f.ApplicantDetails.EmailAddress         = "[email protected]";

                f.PaymentDetails.HasBankAccount = true;
                f.PaymentDetails.AccountNumber  = "12345";
                f.PaymentDetails.SortCode       = "12-34-56";
            });

            var coc = new ChangeOfCircsBuilder("form").Insert();

            coc.AddIdentity("*****@*****.**");

            coc.ExistingApplicantDetails.Title.Should().Be("tst_title");
            coc.ExistingApplicantDetails.FullName.Should().Be("tst_fn tst_on tst_sn");
            coc.ExistingApplicantDetails.Address.Line1.Should().Be("al1");
            coc.ExistingApplicantDetails.MobilePhoneNumber.Should().Be("123");
            coc.ExistingApplicantDetails.HomePhoneNumer.Should().Be("234");
            coc.ExistingApplicantDetails.EmailAddress.Should().Be("[email protected]");

            coc.ExistingPaymentDetails.HasBankAccount.Should().BeTrue();
            coc.ExistingPaymentDetails.AccountNumber.Should().BeNull();
            coc.ExistingPaymentDetails.SortCode.Should().BeNull();
        }