public void TestValidate() { var model = new TestModel(); Account modelAccount = new Account(); modelAccount.Target = 1; ModelMetadataProvider metadataProvider = new DataAnnotationsModelMetadataProvider(); HttpActionContext actionContext = ContextUtils.CreateActionContext(); var transactions = new List <TestModel>() { model }; List <Account> accounts = new List <Account>() { modelAccount }; actionContext.ControllerContext.Configuration.Services.Add(typeof(ModelValidatorProvider), new MethodModelValidatorProvider()); var result = new DefaultBodyModelValidator().Validate(transactions, typeof(TestModel), metadataProvider, actionContext, string.Empty); //var result = new DefaultBodyModelValidator().Validate(modelAccount, typeof(List<Account>), metadataProvider, actionContext, string.Empty); Assert.IsFalse(result); }