public void FailWhenPointIsTooFarRight() { ValidatorCurrency validator = new ValidatorCurrency(); string errorMsg; bool result = validator.ValidateField("12345678.9", out errorMsg); Assert.IsFalse(result); Assert.AreEqual(errorMsg, "Field is not a currency (expected format: dd.dd): 12345678.9", "errorMsg is: " + errorMsg); }
public void PassWhenFieldIsCurrency() { ValidatorCurrency validator = new ValidatorCurrency(); string errorMsg; bool result = validator.ValidateField("1234567.89", out errorMsg); Assert.IsTrue(result); Assert.AreEqual(errorMsg, "", "errorMsg is: " + errorMsg); }
public void FailWhenFieldContainsCurrencySymbol() { ValidatorCurrency validator = new ValidatorCurrency(); string errorMsg; bool result = validator.ValidateField("£1234567.89", out errorMsg); Assert.IsFalse(result); Assert.AreEqual(errorMsg, "Field is not a currency (expected format: dd.dd): £1234567.89", "errorMsg is: " + errorMsg); }