Fixing build break
* Run ModelBinding test that uses Moq to run under ASPNET50 * Update AssociatedValidatorProviderTest to reflect API changes
This commit is contained in:
parent
fe1bcc7a24
commit
bef9af4679
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#if ASPNET50
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
@ -169,3 +171,5 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -19,11 +19,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
public void GetValidatorsForPropertyWithLocalAttributes()
|
public void GetValidatorsForPropertyWithLocalAttributes()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
IEnumerable<Attribute> callbackAttributes = null;
|
IEnumerable<object> callbackAttributes = null;
|
||||||
var metadata = _metadataProvider.GetMetadataForProperty(null, typeof(PropertyModel), "LocalAttributes");
|
var metadata = _metadataProvider.GetMetadataForProperty(null, typeof(PropertyModel), "LocalAttributes");
|
||||||
var provider = new Mock<TestableAssociatedValidatorProvider> { CallBase = true };
|
var provider = new Mock<TestableAssociatedValidatorProvider> { CallBase = true };
|
||||||
provider.Setup(p => p.AbstractGetValidators(metadata, It.IsAny<IEnumerable<Attribute>>()))
|
provider.Setup(p => p.AbstractGetValidators(metadata, It.IsAny<IEnumerable<object>>()))
|
||||||
.Callback<ModelMetadata, IEnumerable<Attribute>>((m, attributes) => callbackAttributes = attributes)
|
.Callback<ModelMetadata, IEnumerable<object>>((m, attributes) => callbackAttributes = attributes)
|
||||||
.Returns((IEnumerable<IModelValidator>)null)
|
.Returns((IEnumerable<IModelValidator>)null)
|
||||||
.Verifiable();
|
.Verifiable();
|
||||||
|
|
||||||
|
|
@ -39,11 +39,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
public void GetValidatorsForPropertyWithMetadataAttributes()
|
public void GetValidatorsForPropertyWithMetadataAttributes()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
IEnumerable<Attribute> callbackAttributes = null;
|
IEnumerable<object> callbackAttributes = null;
|
||||||
var metadata = _metadataProvider.GetMetadataForProperty(null, typeof(PropertyModel), "MetadataAttributes");
|
var metadata = _metadataProvider.GetMetadataForProperty(null, typeof(PropertyModel), "MetadataAttributes");
|
||||||
Mock<TestableAssociatedValidatorProvider> provider = new Mock<TestableAssociatedValidatorProvider> { CallBase = true };
|
var provider = new Mock<TestableAssociatedValidatorProvider> { CallBase = true };
|
||||||
provider.Setup(p => p.AbstractGetValidators(metadata, It.IsAny<IEnumerable<Attribute>>()))
|
provider.Setup(p => p.AbstractGetValidators(metadata, It.IsAny<IEnumerable<object>>()))
|
||||||
.Callback<ModelMetadata, IEnumerable<Attribute>>((m, attributes) => callbackAttributes = attributes)
|
.Callback<ModelMetadata, IEnumerable<object>>((m, attributes) => callbackAttributes = attributes)
|
||||||
.Returns((IEnumerable<IModelValidator>)null)
|
.Returns((IEnumerable<IModelValidator>)null)
|
||||||
.Verifiable();
|
.Verifiable();
|
||||||
|
|
||||||
|
|
@ -59,11 +59,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
public void GetValidatorsForPropertyWithMixedAttributes()
|
public void GetValidatorsForPropertyWithMixedAttributes()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
IEnumerable<Attribute> callbackAttributes = null;
|
IEnumerable<object> callbackAttributes = null;
|
||||||
var metadata = _metadataProvider.GetMetadataForProperty(null, typeof(PropertyModel), "MixedAttributes");
|
var metadata = _metadataProvider.GetMetadataForProperty(null, typeof(PropertyModel), "MixedAttributes");
|
||||||
Mock<TestableAssociatedValidatorProvider> provider = new Mock<TestableAssociatedValidatorProvider> { CallBase = true };
|
var provider = new Mock<TestableAssociatedValidatorProvider> { CallBase = true };
|
||||||
provider.Setup(p => p.AbstractGetValidators(metadata, It.IsAny<IEnumerable<Attribute>>()))
|
provider.Setup(p => p.AbstractGetValidators(metadata, It.IsAny<IEnumerable<object>>()))
|
||||||
.Callback<ModelMetadata, IEnumerable<Attribute>>((m, attributes) => callbackAttributes = attributes)
|
.Callback<ModelMetadata, IEnumerable<object>>((m, attributes) => callbackAttributes = attributes)
|
||||||
.Returns((IEnumerable<IModelValidator>)null)
|
.Returns((IEnumerable<IModelValidator>)null)
|
||||||
.Verifiable();
|
.Verifiable();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue