public void GivenValidate_WhenHavingMoreThan100Name_ThenResultShouldBeInvalid() { var model = CreateCityModelFactory.Default().WithName(new string('*', 101)); var validator = new CreateCityModelValidator(); var result = validator.Validate(model); result.IsValid.Should().BeFalse(); result.Errors.Count.Should().Be(1); }
public void GivenValidate_WhenHavingAnEmptyName_ThenResultShouldBeInvalid() { var model = CreateCityModelFactory.Default().WithName(""); var validator = new CreateCityModelValidator(); var result = validator.Validate(model); result.IsValid.Should().BeFalse(); result.Errors.Count.Should().Be(1); }
public void GivenValidate_WhenHavingValidInput_ThenResultShouldBeValid() { var model = CreateCityModelFactory.Default(); var validator = new CreateCityModelValidator(); var result = validator.Validate(model); result.IsValid.Should().BeTrue(); result.Errors.Count.Should().Be(0); }