public void Defaults () { var dv = new PokerDynamicValidator (); Assert.IsNull (dv.Column, "#A1"); Assert.IsNotNull (dv.ColumnName, "#A2"); Assert.AreEqual (String.Empty, dv.ColumnName, "#A2-1"); Assert.IsNull (dv.GetValidationException (), "#A3"); }
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 ValidateException () { var dv = new PokerDynamicValidator (); dv.CallValidateException (null); Assert.IsNull (dv.GetValidationException (), "#A1"); Exception ex = new Exception (); dv.CallValidateException (ex); Assert.IsNull (dv.GetValidationException (), "#B1"); ex = new ValidationException ("test message"); dv.CallValidateException (ex); Assert.IsNotNull (dv.GetValidationException (), "#C1"); Assert.AreEqual (ex, dv.GetValidationException (), "#C1-1"); Assert.AreEqual ("test message", dv.GetValidationException ().Message, "#C1-2"); }
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"); }