public void NullableProperty_ValueEquals_ValidatesAndSetsMessage()
        {
            var validator = new TestValidatorForNullableProperties();

            var em = new CreateEmployeeRequest
            {
                NullableNumber = 3
            };

            var validationResult = validator.Validate(em);


            Assert.That(validationResult.IsValid, Is.True);
        }
        public void NullableProperty_ValueIsNull_ValidatesAndSetsMessage()
        {
            var validator = new TestValidatorForNullableProperties();

            var em = new CreateEmployeeRequest
            {
                NullableNumber = null
            };

            var validationResult = validator.Validate(em);


            Assert.That(validationResult.IsValid, Is.False);
            var validationFailure = validationResult.ValidationFailures.ToList()[0];

            Assert.That(validationFailure.ValidationMessages.First(), Is.EqualTo("The value of NullableNumber must not be null"));
        }
        public void NullableProperty_ValidatesAndSetsMessage()
        {
            var validator = new TestValidatorForNullableProperties();

            var em = new CreateEmployeeRequest
            {
                NullableNumber = 2
            };

            var validationResult = validator.Validate(em);

            var validationFailure = validationResult.ValidationFailures.ToList()[0];

            Assert.That(validationResult.IsValid, Is.False);
            Assert.That(validationFailure.FieldName, Is.EqualTo("NullableNumber"));
            Assert.That(validationFailure.ValidationMessages.ToList()[0], Is.EqualTo("The value of NullableNumber must be greater than or equal to 3"));
        }