public void Validate_WhenCountryIsInvalid_ShouldHaveValidationErrorFor(EnumCountryIsoCode countryIsoCode) { // Arrange var validator = new CreateAddressRequestValidator(TestOptionsWrapper); // Act validator.ShouldHaveValidationErrorFor(request => request.CountryIsoCode, countryIsoCode); }
public void Validate_WhenPostalCodeIsValid_ShouldNotHaveValidationErrorFor(EnumCountryIsoCode countryIsoCode, string postalCode) { // Arrange var validator = new CreateAddressRequestValidator(TestOptionsWrapper); // Act - Assert validator.ShouldNotHaveValidationErrorFor( request => request.PostalCode, new CreateAddressRequest { CountryIsoCode = countryIsoCode, PostalCode = postalCode }); }
public void Validate_WhenCityIsValid_ShouldNotHaveValidationErrorFor(EnumCountryIsoCode countryIsoCode, string city) { // Arrange var validator = new CreateAddressRequestValidator(TestOptionsWrapper); // Act - Assert validator.ShouldNotHaveValidationErrorFor( request => request.City, new CreateAddressRequest { CountryIsoCode = countryIsoCode, City = city }); }
public void Validate_WhenLine2IsValid_ShouldNotHaveValidationErrorFor(EnumCountryIsoCode countryIsoCode, string line2) { // Arrange var validator = new CreateAddressRequestValidator(TestOptionsWrapper); // Act - Assert validator.ShouldNotHaveValidationErrorFor( request => request.Line2, new CreateAddressRequest { CountryIsoCode = countryIsoCode, Line2 = line2 }); }
public void Validate_WhenPostalCodeIsInvalid_ShouldHaveValidationErrorFor(EnumCountryIsoCode countryIsoCode, string postalCode) { // Arrange var errors = TestOptionsWrapper.Value.GetPostalCodeErrorsFor(countryIsoCode); var validator = new CreateAddressRequestValidator(TestOptionsWrapper); // Act var failures = validator.ShouldHaveValidationErrorFor( request => request.PostalCode, new CreateAddressRequest { CountryIsoCode = countryIsoCode, PostalCode = postalCode }); // Assert failures.Select(failure => failure.ErrorMessage).Any(error => errors.Contains(error)).Should().BeTrue(); }