public static void Validate_NullCommencementDate_ReturnsExpectedResult( DefaultDeliveryDateModel model, DefaultDeliveryDateValidator validator) { (bool isValid, ErrorsModel errors) = validator.Validate(model, null); isValid.Should().BeFalse(); errors.Should().NotBeNull(); errors.Errors.Should().NotBeNull(); errors.Errors.Should().HaveCount(1); errors.Errors.First().Should().BeEquivalentTo(DefaultDeliveryDateValidator.CommencementDateRequired); }
public static void Validate_DateAtLimit_ReturnsExpectedResult( DateTime commencementDate, [Frozen] ValidationSettings validationSettings, DefaultDeliveryDateModel model, DefaultDeliveryDateValidator validator) { model.DeliveryDate = commencementDate.AddDays(validationSettings.MaxDeliveryDateOffsetInDays); (bool isValid, ErrorsModel errors) = validator.Validate(model, commencementDate); isValid.Should().BeTrue(); errors.Should().NotBeNull(); errors.Errors.Should().NotBeNull(); errors.Errors.Should().HaveCount(0); }
public static void Validate_DateBeforeCommencementDate_ReturnsExpectedResult( DateTime commencementDate, DefaultDeliveryDateModel model, DefaultDeliveryDateValidator validator) { model.DeliveryDate = commencementDate.AddDays(-1); (bool isValid, ErrorsModel errors) = validator.Validate(model, commencementDate); isValid.Should().BeFalse(); errors.Should().NotBeNull(); errors.Errors.Should().NotBeNull(); errors.Errors.Should().HaveCount(1); errors.Errors.First().Should().BeEquivalentTo(DefaultDeliveryDateValidator.OutsideWindow); }
public static void Validate_DateOutsideWindow_ReturnsExpectedResult( DateTime commencementDate, [Frozen] ValidationSettings validationSettings, DefaultDeliveryDateModel model, DefaultDeliveryDateValidator validator) { model.DeliveryDate = commencementDate.AddDays(validationSettings.MaxDeliveryDateOffsetInDays + 1); (bool isValid, ErrorsModel errors) = validator.Validate(model, commencementDate); isValid.Should().BeFalse(); errors.Should().NotBeNull(); errors.Errors.Should().NotBeNull(); errors.Errors.Should().HaveCount(1); errors.Errors.First().Should().BeEquivalentTo(DefaultDeliveryDateValidator.OutsideWindow); }