Пример #1
0
        protected string GetErrorMessageForAttributeBasedConfigiguredItem <T>(T model, string propertyName)
        {
            // arrange
            Registry.Setup(x => x.GetModelPropertyMetadata(model.GetType(), propertyName)).Returns((ModelMetadataItem)null);

            // act
            var modelTemp = model;
            var metadata  = Provider.GetMetadataForProperty(() => modelTemp, model.GetType(), propertyName);
            var validator = metadata.GetValidators(new ControllerContext()).First();

            // assert
            return(validator.GetClientValidationRules().First().ErrorMessage);
        }