Example #1
0
        public void RequiredValidatorTest()
        {
            var model = new RequiedModelTest
            {
                Apa = "Pasar Jaya",
            };

            Assert.IsTrue(validator.Validate(model));

            model.Apa = "";

            Assert.IsFalse(validator.Validate(model));
        }
Example #2
0
        public void ValidateTest()
        {
            var model = new RequiedModelTest
            {
                Apa = "Pasar Jaya",
            };

            Assert.IsTrue(validator.Validate(model));
            Assert.AreEqual(validator.GetErrorMessages(), new List <string>());

            model.Apa = "";

            Assert.IsFalse(validator.Validate(model));
            Assert.AreEqual(1, validator.GetErrorMessages().Count);
        }