public void Test_FieldIs8_PassWhenShorter() { ValidatorMaxFieldLength validator = new ValidatorMaxFieldLength(8); string errorMsg; bool result = validator.ValidateField("1234567", out errorMsg); Assert.IsTrue(result); Assert.AreEqual(errorMsg, "", "errorMsg is: " + errorMsg); }
public void Test_FieldIs8_FailWhenTooLong() { ValidatorMaxFieldLength validator = new ValidatorMaxFieldLength(8); string errorMsg; bool result = validator.ValidateField("123456789", out errorMsg); Assert.IsFalse(result); Assert.AreEqual(errorMsg, "Field is longer than maximum length (max length: 8): 123456789", "errorMsg is: " + errorMsg); }