Removing Microsoft.AspNet.Mvc dependency from ModelBinding
This commit is contained in:
parent
0f5bbdf417
commit
d9ebb37906
|
|
@ -6,10 +6,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Mvc.OptionDescriptors;
|
|
||||||
using Microsoft.AspNet.Testing;
|
using Microsoft.AspNet.Testing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
|
||||||
using Microsoft.Framework.OptionsModel;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -295,19 +292,17 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
private ModelValidationContext GetModelValidationContext(object model, Type type)
|
private ModelValidationContext GetModelValidationContext(object model, Type type)
|
||||||
{
|
{
|
||||||
var modelStateDictionary = new ModelStateDictionary();
|
var modelStateDictionary = new ModelStateDictionary();
|
||||||
var mvcOptions = new MvcOptions();
|
var provider = new Mock<IModelValidatorProviderProvider>();
|
||||||
var setup = new MvcOptionsSetup();
|
provider.SetupGet(p => p.ModelValidatorProviders)
|
||||||
setup.Invoke(mvcOptions);
|
.Returns(new IModelValidatorProvider[]
|
||||||
var accessor = new Mock<IOptionsAccessor<MvcOptions>>();
|
{
|
||||||
accessor.SetupGet(a => a.Options)
|
new DataAnnotationsModelValidatorProvider(),
|
||||||
.Returns(mvcOptions);
|
new DataMemberModelValidatorProvider()
|
||||||
|
});
|
||||||
var modelMetadataProvider = new EmptyModelMetadataProvider();
|
var modelMetadataProvider = new EmptyModelMetadataProvider();
|
||||||
return new ModelValidationContext(
|
return new ModelValidationContext(
|
||||||
modelMetadataProvider,
|
modelMetadataProvider,
|
||||||
new CompositeModelValidatorProvider(
|
new CompositeModelValidatorProvider(provider.Object),
|
||||||
new DefaultModelValidatorProviderProvider(
|
|
||||||
accessor.Object, Mock.Of<ITypeActivator>(),
|
|
||||||
Mock.Of<IServiceProvider>())),
|
|
||||||
modelStateDictionary,
|
modelStateDictionary,
|
||||||
new ModelMetadata(
|
new ModelMetadata(
|
||||||
provider: modelMetadataProvider,
|
provider: modelMetadataProvider,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.Http": "1.0.0-*",
|
"Microsoft.AspNet.Http": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Mvc": "",
|
|
||||||
"Microsoft.AspNet.Mvc.ModelBinding": "",
|
"Microsoft.AspNet.Mvc.ModelBinding": "",
|
||||||
"Microsoft.AspNet.PipelineCore": "1.0.0-*",
|
"Microsoft.AspNet.PipelineCore": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Routing": "1.0.0-*",
|
"Microsoft.AspNet.Routing": "1.0.0-*",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue