Example #1
0
 public void Add_a_message_to_the_notification()
 {
     Validator validator = new Validator();
      ExampleClassWithValidatedProperties sample1 = new ExampleClassWithValidatedProperties();
      ValidationResult validationResult = validator.Validate(new object[1] { sample1 }, new Dictionary<string, IValidationAware>());
      Assert.IsFalse(validationResult.IsValid);
      Assert.AreEqual(1, validationResult.Errors.Count);
 }
Example #2
0
        public void Show_an_error_on_the_validation_controls()
        {
            IValidationAware controlElement = Mock<IValidationAware>();

             Validator validator = new Validator();
             ExampleClassWithValidatedProperties sample1 = new ExampleClassWithValidatedProperties();
             Dictionary<string, IValidationAware> validationObjects = new Dictionary<string, IValidationAware>();
             validationObjects.Add("ReqField", controlElement);

             using (Record)
             {
            controlElement.ShowError("Some Message");
            LastCall.IgnoreArguments();
             }

             using (Playback)
             {
            validator.Validate(new object[1] { sample1 }, validationObjects);
             }
        }
Example #3
0
        public void Clear_any_errors_on_validation_controls()
        {
            IValidationAware controlElement = Mock<IValidationAware>();

             Validator validator = new Validator();
             ExampleClassWithValidatedProperties sample1 = new ExampleClassWithValidatedProperties();
             sample1.ReqField = "Some String";
             Dictionary<string, IValidationAware> validationObjects = new Dictionary<string, IValidationAware>();
             validationObjects.Add("ReqField", controlElement);

             using (Record)
             {
            controlElement.ClearError();
             }

             using (Playback)
             {
            validator.Validate(new object[1] { sample1 }, validationObjects);
             }
        }