public void HandledTypeConversionExceptionSourceToTarget() { BaseBindingManager dbm = new BaseBindingManager(); IValidationErrors errors = new ValidationErrors(); Hashtable source = new Hashtable(); source["boolValue"] = false; Inventor target = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); SimpleExpressionBinding binding = new SimpleExpressionBinding("['boolValue']", "DOB"); binding.SetErrorMessage("error", "errors"); dbm.AddBinding(binding); dbm.BindSourceToTarget(source, target, errors); Assert.IsFalse(binding.IsValid(errors)); Assert.IsFalse(errors.IsEmpty); Assert.AreEqual(1, errors.GetErrors("errors").Count); // make sure that the old value doesn't override current invalid value dbm.BindTargetToSource(source, target, errors); Assert.AreEqual(false, source["boolValue"]); }