public void AreEqual_Objects(TestObject a, TestObject b, TestExceptionType eType) { object objA = a.GetObject(); object objB = b.GetObject(); this.RunTest(() => this.Checker.AreEqual(objA, objB), eType); }
protected override Type GetExceptionType(TestExceptionType exceptionType) { switch (exceptionType) { case TestExceptionType.ValidationPassed: return(null); case TestExceptionType.ValidationFailed: case TestExceptionType.BoundsCheckFailed: case TestExceptionType.NullCheckFailed: return(typeof(ValidationFailedException)); case TestExceptionType.NotDisposedCheckFailed: return(typeof(ObjectDisposedException)); case TestExceptionType.NullReferenceException: return(typeof(NullReferenceException)); case TestExceptionType.IndexOutOfBoundsException: return(typeof(IndexOutOfRangeException)); default: throw new ArgumentOutOfRangeException(nameof(exceptionType), exceptionType, null); } }
public void Comparison_Floats( float a, CompareOperation operation, float b, float precision, TestExceptionType eType) { this.RunTest(() => this.Checker.Comparison(a, operation, b, precision), eType); }
public void Comparison_Doubles( double a, CompareOperation operation, double b, double precision, TestExceptionType eType) { this.RunTest(() => this.Checker.Comparison(a, operation, b, precision), eType); }
public void IsNotEmpty(int numItems, TestExceptionType eType) { var collection = new List <object>(); for (int i = 0; i < numItems; i++) { collection.Add(new object()); } this.RunTest(() => this.Checker.IsNotEmpty(collection), eType); }
private void RunTest(Func <bool> test, TestExceptionType eType) { if (this.CheckShouldPass(eType)) { Validate.Value.IsTrue(test()); } else { Type exceptionType = this.GetExceptionType(eType); if (exceptionType == null) { Validate.Value.IsFalse(test()); } else { TestUtils.TestForError(exceptionType, () => test()); } } }
public void IsNotZero_int(int value, TestExceptionType eType) { this.RunTest(() => this.Checker.IsNotZero(value), eType); }
public void IsNotNullOrEmpty(string str, TestExceptionType eType) { this.RunTest(() => this.Checker.IsNotNullOrEmpty(str), eType); }
protected abstract Type GetExceptionType(TestExceptionType exceptionType);
protected override Type GetExceptionType(TestExceptionType exceptionType) { return(null); }
public void IsTrue(bool value, TestExceptionType eType) { this.RunTest(() => this.Checker.IsTrue(value), eType); }
public void IsNull(TestObject a, TestExceptionType eType) { this.RunTest(() => this.Checker.IsNull(a.GetObject()), eType); }
public void IsInRange_Objects(TestObject val, TestObject min, TestObject max, TestExceptionType eType) { IComparable value = (IComparable)val.GetObject(); IComparable lower = (IComparable)min.GetObject(); IComparable upper = (IComparable)max.GetObject(); this.RunTest(() => this.Checker.IsInRange(value, lower, upper), eType); }
protected abstract bool CheckShouldPass(TestExceptionType exceptionType);
public void Comparison_Objects(TestObject a, CompareOperation operation, TestObject b, TestExceptionType eType) { IComparable objA = (IComparable)a.GetObject(); IComparable objB = (IComparable)b.GetObject(); this.RunTest(() => this.Checker.Comparison(objA, operation, objB), eType); }
public void IsNotZero_float(float value, float precision, TestExceptionType eType) { this.RunTest(() => this.Checker.IsNotZero(value, precision), eType); }
public void IsNotZero_double(double value, double precision, TestExceptionType eType) { this.RunTest(() => this.Checker.IsNotZero(value, precision), eType); }
public void IsInRange_Floats(float val, float min, float max, float precision, TestExceptionType eType) { this.RunTest(() => this.Checker.IsInRange(val, min, max, precision), eType); }
public void IsNullOrWhiteSpace(string str, TestExceptionType eType) { this.RunTest(() => this.Checker.IsNullOrWhiteSpace(str), eType); }
public void AreEqual_Floats(float a, float b, float precision, TestExceptionType eType) { this.RunTest(() => this.Checker.AreEqual(a, b, precision), eType); }
public void IsTypeOrNull(TestObject val, TestExceptionType eType) { object value = val.GetObject(); this.RunTest(() => this.Checker.IsTypeOrNull <string>(value), eType); }
public void IsInRange_Doubles(double val, double min, double max, double precision, TestExceptionType eType) { this.RunTest(() => this.Checker.IsInRange(val, min, max, precision), eType); }
protected override bool CheckShouldPass(TestExceptionType exceptionType) { return(true); }
public void IsNotDisposed(bool isDisposed, TestExceptionType eType) { this.RunTest(() => this.Checker.IsNotDisposed(new TestDisposable(isDisposed), "TestDisposable"), eType); }
protected override bool CheckShouldPass(TestExceptionType exceptionType) { return(exceptionType == TestExceptionType.ValidationPassed); }
public void AreNotEqual_Doubles(double a, double b, double precision, TestExceptionType eType) { this.RunTest(() => this.Checker.AreNotEqual(a, b, precision), eType); }