public void Test_WithNullValue_ShouldReturnEmptyErrorMessage() { var rule = new PropRuleShort("num", "TestMessage", 5, 10); var errorMessage = ""; Assert.IsTrue(rule.IsPropValueValid("Propname", null, ref errorMessage)); Assert.IsTrue(errorMessage.Length == 0); }
public void Test_WithValueGTMax_ShouldReturnErrorMessage() { var rule = new PropRuleShort("num", "TestMessage", 5, 10); var errorMessage = ""; Assert.IsFalse(rule.IsPropValueValid("Propname", 12, ref errorMessage)); Assert.IsTrue(errorMessage.Length > 0); }
public void Test_WithNegativeNumber_ShouldReturnErrorMessage() { string errorMessage = ""; var rule = new PropRuleShort("num", "TestMessage", 5, 10); Assert.IsFalse(rule.IsPropValueValid("Propname", -5, ref errorMessage)); Assert.IsTrue(errorMessage.Length > 0); }
public void Test_ValueLTMin_ShouldReturnErrorMessage() { var rule = new PropRuleShort("num", "TestMessage", 5, 10); var errorMessage = ""; //Test less than min Assert.IsFalse(rule.IsPropValueValid("Propname", 1, ref errorMessage)); Assert.IsTrue(errorMessage.Length > 0); }
public void IsPropValueValid_GivenValueOutsideShortRange_ShouldReturnFalse() { //---------------Set up test pack------------------- var rule = new PropRuleShort("num", ""); var errorMessage = ""; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var valid = rule.IsPropValueValid("num", int.MaxValue, ref errorMessage); //---------------Test Result ----------------------- Assert.IsFalse(valid); }