public void GivenAValidApplicant_Validation_Succeeds(ApplicantBaseDto applicant, bool isvalid) { sut = new ApplicantBaseValidator <ApplicantBaseDto>(mockFactory.Object); if (isvalid) { Assert.True(sut.Validate(applicant).IsValid); } else { Assert.False(sut.Validate(applicant).IsValid); } }
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); } }
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); } }
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); } }
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); } }