public void Validate_Exclusive() { LongValidator v = new LongValidator(5000L, 10000L, true); v.Validate(1000L); v.Validate(15000L); }
public void Validate_Inclusive() { LongValidator v = new LongValidator(5000L, 10000L, false); v.Validate(5000L); v.Validate(10000L); }
static void Main(string[] args) { // Display title. Console.WriteLine("ASP.NET Validators"); Console.WriteLine(); // Create Long and Validator. Int64 testLong = 17592186044416; Int64 minLongVal = 1099511627776; Int64 maxLongVal = 281474976710656; LongValidator myLongValidator = new LongValidator(minLongVal, maxLongVal, false); // Determine if the object to validate can be validated. Console.WriteLine("CanValidate: {0}", myLongValidator.CanValidate(testLong.GetType())); try { // Attempt validation. myLongValidator.Validate(testLong); Console.WriteLine("Validated."); } catch (ArgumentException e) { // Validation failed. Console.WriteLine("Error: {0}", e.Message.ToString()); } // Display and wait Console.ReadLine(); }
public void Validate_Resolution() { LongValidator v = new LongValidator(20000L, 50000L, false, 3000L); v.Validate(40000L); }
public void Validate_Resolution() { LongValidator v = new LongValidator(20000L, 50000L, false, 3000L); Assert.Throws <ArgumentException>(() => v.Validate(40000L)); }
public void Validate_Exclusive_fail3() { LongValidator v = new LongValidator(5000L, 10000L, true); v.Validate(7000L); }
public void Validate_inRange() { LongValidator v = new LongValidator(5000L, 10000L); v.Validate(7000L); }
public void Validate_Exclusive_fail3() { LongValidator v = new LongValidator(5000L, 10000L, true); Assert.Throws <ArgumentException>(() => v.Validate(7000L)); }
public void Validate_Exclusive_fail2() { LongValidator v = new LongValidator(5000L, 10000L, true); AssertExtensions.Throws <ArgumentException>(null, () => v.Validate(10000L)); }