public void NullCreateExceptionShouldThrow() { var guard = new Guard<object>(); guard.AddPredicate(o => o != null, null); Assert.Fail("Should have thrown ArgumentNullException."); }
public void NullTargetShouldThrow() { var guard = new Guard<object>(); guard.AddPredicate(o => o != null, o => new ArgumentNullException()); guard.Evaluate(null); }
public void NullPredicateShouldThrow() { var guard = new Guard<object>(); guard.AddPredicate(null, o => new Exception()); Assert.Fail("Should have thrown ArgumentNullException."); }
public void SuccessfulEvaluationShouldReturnTarget() { var target = new object(); var guard = new Guard<object>(); guard.AddPredicate(o => o != null, o => new ArgumentNullException()); Assert.AreEqual(target, guard.Evaluate(target)); }