Exemple #1
0
        public void GivenNewAppointmentWhenEndDateBeforeStartDateThenReturnsInvalid()
        {
            var model = new NewAppointmentViewModel()
            {
                StartDate = DateTime.Today, EndDate = DateTime.Today.AddDays(-1)
            };
            NewAppointmentValidator validator = new NewAppointmentValidator();

            FluentValidation.Results.ValidationResult results = validator.Validate(model);

            Assert.That(results.IsValid, Is.False);
            Assert.That(results.Errors.Any(x => x.PropertyName == nameof(NewAppointmentViewModel.EndDate)), Is.True);
        }
Exemple #2
0
        public void GivenNewAppointmentWhenInvalidLocationLengthThenReturnsInvalid()
        {
            var model = new NewAppointmentViewModel()
            {
                Location = new string('-', 256)
            };
            NewAppointmentValidator validator = new NewAppointmentValidator();

            FluentValidation.Results.ValidationResult results = validator.Validate(model);

            Assert.That(results.IsValid, Is.False);
            Assert.That(results.Errors.Any(x => x.PropertyName == nameof(NewAppointmentViewModel.Location)), Is.True);
        }