public void ValidationException () { var dv = new PokerDynamicValidator (); Assert.IsNull (dv.GetValidationException (), "#A1"); Exception ex = new Exception (); dv.SetValidationException (ex); Assert.AreEqual (ex, dv.GetValidationException (), "#B1"); ex = new ArgumentNullException (); dv.SetValidationException (ex); Assert.AreEqual (ex, dv.GetValidationException (), "#C1"); dv.SetValidationException (null); Assert.IsNull (dv.GetValidationException (), "#D1"); }
public void EvaluateIsValid () { var dv = new PokerDynamicValidator (); Assert.IsTrue (dv.CallEvaluateIsValid (), "#A1"); Assert.IsNotNull (dv.ControlToValidate, "#A1-1"); Assert.AreEqual (String.Empty, dv.ControlToValidate, "#A1-2"); Assert.AreEqual (String.Empty, dv.ErrorMessage, "#A1-3"); dv.SetValidationException (new Exception ("test message")); Assert.IsFalse (dv.CallEvaluateIsValid (), "#A2"); Assert.AreEqual (dv.GetValidationException ().Message, dv.ErrorMessage, "#A2-1"); dv.SetValidationException (new Exception ("<script>message</script>")); Assert.IsFalse (dv.CallEvaluateIsValid (), "#A3"); Assert.AreEqual (HttpUtility.HtmlEncode (dv.GetValidationException ().Message), dv.ErrorMessage, "#A3-1"); }