Ejemplo n.º 1
0
        public void TestMethod_AddInt()
        {
            FieldValidationHandler <int> fieldValidationHandler = new FieldValidationHandler <int>((z) => true, null);
            int validated = 1;

            FormValidator formValidator = new FormValidator();

            int x = formValidator.Add <int>(fieldValidationHandler, validated);
            int y = formValidator.Add <int>(fieldValidationHandler, validated);

            Assert.IsTrue(formValidator.GetId <int>(validated) == x);
            Assert.IsFalse(formValidator.GetId <int>(validated) == y);

            Assert.IsTrue(y == -1);
        }
Ejemplo n.º 2
0
        public void TestMethod_AddTwice()
        {
            FieldValidationHandler <string> fieldValidationHandler = new FieldValidationHandler <string>((z) => true, null);
            string validated = "true";

            FormValidator formValidator = new FormValidator();

            int x = formValidator.Add <string>(fieldValidationHandler, validated);
            int y = formValidator.Add <string>(fieldValidationHandler, validated);

            Assert.IsTrue(formValidator.GetId <string>(validated) == x);
            Assert.IsFalse(formValidator.GetId <string>(validated) == y);

            Assert.IsTrue(y == -1);
        }