public void ByDefaultValidateDataAnnotationOnSetValue() { // By default instance property set to check annotation validation var model = new ModelWithoutAnnotation(); using (model.SuspendValidations()) { model.Counter = 1; Assert.AreEqual(true, model.HasNotValidatedProperties()); } }
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()); } }
public void ByDefaultValidateDataAnnotationOnSetValue() { var oldSuspension = Model.SuspendValidationForAllModels; Model.SuspendValidationForAllModels = true; // By default instance property set to check annotation validation var model = new ModelWithoutAnnotation(); model.Counter = 1; Assert.AreEqual(true, model.HasNotValidatedProperties()); Model.SuspendValidationForAllModels = oldSuspension; }
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; }