コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }