Ejemplo n.º 1
0
            public void OnInstancePropertyIgnoreDataAnnotationSkipAnnotationValidation()
            {
                // Set intance property to skip data annotations validation
                var model = new ModelWithoutAnnotation();

                model.SetValidateUsingDataAnnotations(false);

                model.Validate(true);

                Assert.AreEqual(0, model.Counter);
            }
Ejemplo n.º 2
0
            public void OnInstancePropertyIgnoreDataAnnotationSkipAnnotationValidation()
            {
                // Set intance property to skip data annotations validation
                var model = new ModelWithoutAnnotation();

                using (model.SuspendValidations())
                {
                    model.SetValidateUsingDataAnnotations(false);

                    model.Counter = 1;

                    Assert.AreEqual(false, model.HasNotValidatedProperties());
                }
            }
Ejemplo n.º 3
0
            public void OnInstancePropertyIgnoreDataAnnotationSkipAnnotationValidation()
            {
                var oldSuspension = Model.SuspendValidationForAllModels;

                Model.SuspendValidationForAllModels = true;

                // Set intance property to skip data annotations validation
                var model = new ModelWithoutAnnotation();

                model.SetValidateUsingDataAnnotations(false);

                model.Counter = 1;

                Assert.AreEqual(false, model.HasNotValidatedProperties());

                Model.SuspendValidationForAllModels = oldSuspension;
            }