(adapter);
+ Assert.Equal(expectedRuleName, dataTypeAdapter.RuleName);
+ }
+ }
+}
diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationTest.cs
index 5dc2b6071a..7fb57e680b 100644
--- a/test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationTest.cs
+++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationTest.cs
@@ -84,10 +84,10 @@ mypartial
"Learn More" + Environment.NewLine +
"Hi John ! You are in 2015 year and today is Thursday";
- yield return new[] {"en-GB", expected1 };
+ yield return new[] { "en-GB", expected1 };
var expected2 =
- "Bonjour!" + Environment.NewLine +
+ "Bonjour!" + Environment.NewLine +
"apprendre Encore Plus" + Environment.NewLine +
"Salut John ! Vous êtes en 2015 an aujourd'hui est Thursday";
yield return new[] { "fr", expected2 };
@@ -118,10 +118,10 @@ mypartial
{
// Arrange
var expected =
-@"Nom non valide. Longueur minimale de nom est 4
+@"Nom non valide. Longueur minimale de nom est 6
Nom du produit est invalide
- Nom non valide. Longueur minimale de nom est 4
+ Nom non valide. Longueur minimale de nom est 6
Nom du produit est invalide
";
diff --git a/test/Microsoft.AspNet.Mvc.IntegrationTests/TestMvcOptions.cs b/test/Microsoft.AspNet.Mvc.IntegrationTests/TestMvcOptions.cs
index 8d0fff696b..b9ccf713a9 100644
--- a/test/Microsoft.AspNet.Mvc.IntegrationTests/TestMvcOptions.cs
+++ b/test/Microsoft.AspNet.Mvc.IntegrationTests/TestMvcOptions.cs
@@ -1,9 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using Microsoft.AspNet.Mvc.DataAnnotations;
using Microsoft.AspNet.Mvc.DataAnnotations.Internal;
using Microsoft.AspNet.Mvc.Formatters.Json.Internal;
using Microsoft.AspNet.Mvc.Internal;
+using Microsoft.AspNet.Mvc.ModelBinding;
+using Microsoft.AspNet.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.OptionsModel;
@@ -17,6 +20,9 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests
Value = new MvcOptions();
MvcCoreMvcOptionsSetup.ConfigureMvc(Value, new TestHttpRequestStreamReaderFactory());
var collection = new ServiceCollection().AddOptions();
+ collection.AddSingleton();
+ collection.AddSingleton();
+ collection.AddSingleton();
MvcDataAnnotationsMvcOptionsSetup.ConfigureMvc(
Value,
collection.BuildServiceProvider());
diff --git a/test/Microsoft.AspNet.Mvc.TestCommon/TestClientModelValidatorProvider.cs b/test/Microsoft.AspNet.Mvc.TestCommon/TestClientModelValidatorProvider.cs
index 18b56d683d..0c9989af5f 100644
--- a/test/Microsoft.AspNet.Mvc.TestCommon/TestClientModelValidatorProvider.cs
+++ b/test/Microsoft.AspNet.Mvc.TestCommon/TestClientModelValidatorProvider.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
+using Microsoft.AspNet.Mvc.DataAnnotations;
namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
{
@@ -14,6 +15,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
{
new DefaultClientModelValidatorProvider(),
new DataAnnotationsClientModelValidatorProvider(
+ new ValidationAttributeAdapterProvider(),
new TestOptionsManager(),
stringLocalizerFactory: null),
};
diff --git a/test/Microsoft.AspNet.Mvc.TestCommon/TestModelValidatorProvider.cs b/test/Microsoft.AspNet.Mvc.TestCommon/TestModelValidatorProvider.cs
index 9f347ec3eb..a44811030f 100644
--- a/test/Microsoft.AspNet.Mvc.TestCommon/TestModelValidatorProvider.cs
+++ b/test/Microsoft.AspNet.Mvc.TestCommon/TestModelValidatorProvider.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
+using Microsoft.AspNet.Mvc.DataAnnotations;
namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
{
@@ -14,8 +15,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
{
new DefaultModelValidatorProvider(),
new DataAnnotationsModelValidatorProvider(
+ new ValidationAttributeAdapterProvider(),
new TestOptionsManager(),
- stringLocalizerFactory: null),
+ stringLocalizerFactory: null)
};
return new TestModelValidatorProvider(providers);
diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerTest.cs
index 2f665da687..969c004a77 100644
--- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerTest.cs
+++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerTest.cs
@@ -1863,9 +1863,12 @@ namespace Microsoft.AspNet.Mvc.Test
HttpContext = httpContext,
ModelBinders = new[] { binder, },
ValueProviders = new[] { valueProvider, },
- ValidatorProviders = new []
+ ValidatorProviders = new[]
{
- new DataAnnotationsModelValidatorProvider(options: null, stringLocalizerFactory: null),
+ new DataAnnotationsModelValidatorProvider(
+ new ValidationAttributeAdapterProvider(),
+ new TestOptionsManager(),
+ stringLocalizerFactory: null),
},
};
diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/DefaultTemplatesUtilities.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/DefaultTemplatesUtilities.cs
index 2feed8b4c1..9a30a9bae2 100644
--- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/DefaultTemplatesUtilities.cs
+++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/DefaultTemplatesUtilities.cs
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Antiforgery;
using Microsoft.AspNet.Http.Internal;
using Microsoft.AspNet.Mvc.Abstractions;
+using Microsoft.AspNet.Mvc.DataAnnotations;
using Microsoft.AspNet.Mvc.ModelBinding;
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
using Microsoft.AspNet.Mvc.Routing;
@@ -226,6 +227,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
localizationOptionsAccesor.SetupGet(o => o.Value).Returns(new MvcDataAnnotationsLocalizationOptions());
options.ClientModelValidatorProviders.Add(new DataAnnotationsClientModelValidatorProvider(
+ new ValidationAttributeAdapterProvider(),
localizationOptionsAccesor.Object,
stringLocalizerFactory: null));
var optionsAccessor = new Mock>();
diff --git a/test/WebSites/LocalizationWebSite/Models/User.cs b/test/WebSites/LocalizationWebSite/Models/User.cs
index 4ecd4f0770..632be4255f 100644
--- a/test/WebSites/LocalizationWebSite/Models/User.cs
+++ b/test/WebSites/LocalizationWebSite/Models/User.cs
@@ -7,7 +7,7 @@ namespace LocalizationWebSite.Models
{
public class User
{
- [MinLength(4, ErrorMessage = "NameError")]
+ [MinLength(6, ErrorMessage = "NameError")]
public string Name { get; set; }
public Product Product { get; set; }
diff --git a/test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.User.fr.resx b/test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.User.fr.resx
index f3563679cd..444a07866f 100644
--- a/test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.User.fr.resx
+++ b/test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.User.fr.resx
@@ -118,6 +118,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- Nom non valide. Longueur minimale de nom est 4
+ Nom non valide. Longueur minimale de nom est {1}
\ No newline at end of file