public void Validator_WhenCountryCodeIsNotSpecified_ShouldHaveValidationFailure()
        {
            string  code    = null;
            string  name    = _fixture.Create <string>();
            Country country = new Country(code, name);

            _countryValidator.ShouldHaveValidationErrorFor(c => c.Code, country);
        }
Beispiel #2
0
        public void Validator_WhenPropertiesAreNull_ShouldHaveValidationFailure()
        {
            User user = new User(null, null, null, null);

            _userValidator.ShouldHaveValidationErrorFor(u => u.FirstName, user);
            _userValidator.ShouldHaveValidationErrorFor(u => u.LastName, user);
            _userValidator.ShouldHaveValidationErrorFor(u => u.Email, user);
            _userValidator.ShouldHaveValidationErrorFor(u => u.Country, user);
            _mockCountryValidator.Verify(call => call.Validate(It.IsAny <ValidationContext>()), Times.Never());
        }