Пример #1
0
        public override void Validate(object value)
        {
            ValidatorUtils.HelperParamValidation(value, typeof(TimeSpan));

            ValidatorUtils.ValidateScalar((TimeSpan)value,
                                          _minValue,
                                          _maxValue,
                                          _resolution,
                                          _flags == ValidationFlags.ExclusiveRange);
        }
Пример #2
0
        public void ValidateIntBadResolution(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string message)
        {
            Action action = () => ValidatorUtils.ValidateScalar(value, min, max, resolution, exclusiveRange);

            if (!shouldThrow)
            {
                action();
            }
            else
            {
                Assert.Equal(
                    string.Format(SR.GetResourceString(message, null), resolution),
                    Assert.Throws <ArgumentException>(action).Message);
            }
        }