コード例 #1
0
        public void Validator_WhenValidCodeAndNameAreSpecified_ShouldNotHaveValidationFailure()
        {
            const string code    = "CAN";
            string       name    = _fixture.Create <string>();
            Country      country = new Country(code, name);

            _countryValidator.ShouldNotHaveValidationErrorFor(c => c.Code, country);
            _countryValidator.ShouldNotHaveValidationErrorFor(c => c.Name, country);
        }
コード例 #2
0
        public void Validator_WhenUserModelIsValid_ShouldNotHaveValidationFailure()
        {
            string       firstName = _fixture.Create <string>();
            string       lastName  = _fixture.Create <string>();
            const string email     = "*****@*****.**";
            Country      country   = new Country("CAN", _fixture.Create <string>());

            User user = new User(firstName, lastName, email, country);

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