public void Validator_IsValidationContextValid()
        {
            ValTestClass_PropertyLevel_Validation obj = new ValTestClass_PropertyLevel_Validation()
            {
                ObjectProperty = new object()
            };
            ValidationContext context = new ValidationContext(obj, null, null);

            context.Items.Add(typeof(int), "int expected");
            context.Items.Add(typeof(string), "string expected");

            Assert.IsTrue(Validator.TryValidateObject(obj, context, null, true));
        }
        // Validation method verifies expected ValidationContext is received during property-level validation.
        public static ValidationResult IsValTest_IsValidationContextValid(object value, ValidationContext context)
        {
            ValTestClass_PropertyLevel_Validation originalObjectReference = context.ObjectInstance as ValTestClass_PropertyLevel_Validation;

            if ((string)context.Items[typeof(int)] != "int expected")
            {
                return(new ValidationResult(null));
            }
            if ((string)context.Items[typeof(string)] != "string expected")
            {
                return(new ValidationResult(null));
            }

            return(null);
        }
        public void Validator_IsValidationContextValid() {
            ValTestClass_PropertyLevel_Validation obj = new ValTestClass_PropertyLevel_Validation() { ObjectProperty = new object() };
            ValidationContext context = new ValidationContext(obj, null, null);

            context.Items.Add(typeof(int), "int expected");
            context.Items.Add(typeof(string), "string expected");

            Assert.IsTrue(Validator.TryValidateObject(obj, context, null, true));
        }