public void Init() { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us"); validator = new IntegerValidator(); validator.Initialize(new CachedValidationRegistry(), typeof(TestTarget).GetProperty("TargetField")); target = new TestTarget(); }
public void ValidNullableInt16() { validator = new IntegerValidator(); validator.Initialize(new CachedValidationRegistry(), typeof(TestTarget).GetProperty("TargetField16Nullable")); Assert.IsTrue(validator.IsValid(target, "100")); Assert.IsTrue(validator.IsValid(target, "-99")); Assert.IsTrue(validator.IsValid(target, null)); Assert.IsTrue(validator.IsValid(target, "")); Assert.IsTrue(validator.IsValid(target, short.MinValue)); Assert.IsTrue(validator.IsValid(target, short.MaxValue)); }
public void ValidInt64() { validator = new IntegerValidator(); validator.Initialize(new CachedValidationRegistry(), typeof(TestTarget).GetProperty("TargetField64")); Assert.IsTrue(validator.IsValid(target, "100")); Assert.IsTrue(validator.IsValid(target, "-99")); Assert.IsTrue(validator.IsValid(target, null)); Assert.IsTrue(validator.IsValid(target, "")); Assert.IsTrue(validator.IsValid(target, long.MinValue)); Assert.IsTrue(validator.IsValid(target, long.MaxValue)); }