public void CanCreateValidatorWithoutCulture() { MockRangeValidatorData validatorData = new MockRangeValidatorData(); validatorData.Culture = null; validatorData.LowerBound = (12.4d).ToString(CultureInfo.CurrentCulture); validatorData.LowerBoundType = RangeBoundaryType.Inclusive; validatorData.UpperBound = (22.4d).ToString(CultureInfo.CurrentCulture); validatorData.UpperBoundType = RangeBoundaryType.Inclusive; var validator = validatorData.CreateValidator(typeof(double)); Assert.IsFalse(validator.Validate(12.3d).IsValid); Assert.IsTrue(validator.Validate(13.3d).IsValid); }
public void CanCreateValidatorWithSpecificCulture() { MockRangeValidatorData validatorData = new MockRangeValidatorData(); validatorData.Culture = CultureInfo.GetCultureInfo("nl-NL"); validatorData.LowerBound = "12,4"; validatorData.LowerBoundType = RangeBoundaryType.Inclusive; validatorData.UpperBound = "24,4"; validatorData.UpperBoundType = RangeBoundaryType.Inclusive; var validator = validatorData.CreateValidator(typeof(double)); Assert.IsFalse(validator.Validate(12.3d).IsValid); Assert.IsTrue(validator.Validate(13.3d).IsValid); }