コード例 #1
0
        public void GivenEmailAddress_ValidationConfirmsToSpecifiedExpectedResults(string emailAddress, bool isValid)
        {
            var sut = new ApplicantBaseValidator <ApplicantBaseDto>(mockFactory.Object);

            var applicant = new ApplicantBaseDto
            {
                EmailAddress = emailAddress
            };

            if (isValid)
            {
                sut.ShouldNotHaveValidationErrorFor(x => x.EmailAddress, applicant);
            }

            else
            {
                sut.ShouldHaveValidationErrorFor(x => x.EmailAddress, applicant);
            }
        }
コード例 #2
0
        public void GivenAge_ValidationConfirmsToSpecifiedExpectedResults(int age, bool isValid)
        {
            var sut = new ApplicantBaseValidator <ApplicantBaseDto>(mockFactory.Object);

            var applicant = new ApplicantBaseDto
            {
                Age = age
            };

            if (isValid)
            {
                sut.ShouldNotHaveValidationErrorFor(x => x.Age, applicant);
            }

            else
            {
                sut.ShouldHaveValidationErrorFor(x => x.Age, applicant);
            }
        }
コード例 #3
0
        public void GivenFamilyName_ValidationConfirmsToSpecifiedExpectedResults(string familyName, bool isValid)
        {
            var sut = new ApplicantBaseValidator <ApplicantBaseDto>(mockFactory.Object);

            var applicant = new ApplicantBaseDto
            {
                FamilyName = familyName
            };

            if (isValid)
            {
                sut.ShouldNotHaveValidationErrorFor(x => x.FamilyName, applicant);
            }

            else
            {
                sut.ShouldHaveValidationErrorFor(x => x.FamilyName, applicant);
            }
        }
コード例 #4
0
        public void GivenCountryName_ValidationConfirmsToSpecifiedExpectedResults(string countryname, bool isValid)
        {
            var sut = new ApplicantBaseValidator <ApplicantBaseDto>(mockFactory.Object);

            var applicant = new ApplicantBaseDto
            {
                CountryOfOrigin = countryname
            };

            if (isValid)
            {
                SetUpMockClient(HttpStatusCode.OK);

                sut.ShouldNotHaveValidationErrorFor(x => x.CountryOfOrigin, applicant);
            }

            else
            {
                SetUpMockClient(HttpStatusCode.BadRequest);

                sut.ShouldHaveValidationErrorFor(x => x.CountryOfOrigin, applicant);
            }
        }