コード例 #1
0
        public void Test_MonthIsInvalid()
        {
            ValidatorDate_YYYYMMDD validator = new ValidatorDate_YYYYMMDD();

            string errorMsg;

            bool result = validator.ValidateField("20153007", out errorMsg);

            Assert.IsFalse(result);
            Assert.AreEqual(errorMsg, "Field is not a date: 20153007", "errorMsg is: " + errorMsg);
        }
コード例 #2
0
        public void Test_FieldIsTooShort()
        {
            ValidatorDate_YYYYMMDD validator = new ValidatorDate_YYYYMMDD();

            string errorMsg;

            bool result = validator.ValidateField("2015100", out errorMsg);

            Assert.IsFalse(result);
            Assert.AreEqual(errorMsg, "Field is not correct format (YYYYMMDD): 2015100", "errorMsg is: " + errorMsg);
        }
コード例 #3
0
        public void Test_FieldIsYYYYMMDD()
        {
            ValidatorDate_YYYYMMDD validator = new ValidatorDate_YYYYMMDD();

            string errorMsg;

            bool result = validator.ValidateField("20151007", out errorMsg);

            Assert.IsTrue(result);
            Assert.AreEqual(errorMsg, "", "errorMsg is: " + errorMsg);
        }
コード例 #4
0
        public void Test_FieldContainsAlphaChars()
        {
            ValidatorDate_YYYYMMDD validator = new ValidatorDate_YYYYMMDD();

            string errorMsg;

            bool result = validator.ValidateField("abcdefgh", out errorMsg);

            Assert.IsFalse(result);
            Assert.AreEqual(errorMsg, "Field is not a date: abcdefgh", "errorMsg is: " + errorMsg);
        }