diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataAnnotationsMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataAnnotationsMetadataProviderTest.cs index b379e073a5..b2353ee428 100644 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataAnnotationsMetadataProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataAnnotationsMetadataProviderTest.cs @@ -156,8 +156,13 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata var display = new DisplayAttribute() { - Name = "DisplayAttribute_Name", +#if USE_REAL_RESOURCES + Name = nameof(Test.Resources.DisplayAttribute_Name), + ResourceType = typeof(Test.Resources), +#else + Name = nameof(Test.Resources.DisplayAttribute_Name), ResourceType = typeof(Test.TestResources), +#endif }; var attributes = new Attribute[] { display }; @@ -180,8 +185,13 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata var display = new DisplayAttribute() { - Description = "DisplayAttribute_Description", +#if USE_REAL_RESOURCES + Description = nameof(Test.Resources.DisplayAttribute_Description), + ResourceType = typeof(Test.Resources), +#else + Description = nameof(Test.Resources.DisplayAttribute_Description), ResourceType = typeof(Test.TestResources), +#endif }; var attributes = new Attribute[] { display }; @@ -568,7 +578,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata [Display(Name = "menos uno")] MinusOne = -1, +#if USE_REAL_RESOURCES + [Display(Name = nameof(Test.Resources.DisplayAttribute_Name), ResourceType = typeof(Test.Resources))] +#else [Display(Name = nameof(Test.TestResources.DisplayAttribute_Name), ResourceType = typeof(Test.TestResources))] +#endif MinusTwo = -2, } diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestResources.cs b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestResources.cs index 0868418b9a..1f5f61e583 100644 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestResources.cs +++ b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestResources.cs @@ -3,12 +3,12 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Test { - // This class is a 'fake' resources for testing DisplayAttribute. We can't use actual resources - // because our generator makes it an internal class, which doesn't work with DisplayAttribute. + // Wrap resources to make them available as public properties for [Display]. That attribute does not support + // internal properties. public static class TestResources { - public static string DisplayAttribute_Description { get; } = "description from resources"; + public static string DisplayAttribute_Description { get; } = Resources.DisplayAttribute_Description; - public static string DisplayAttribute_Name { get; } = "name from resources"; + public static string DisplayAttribute_Name { get; } = Resources.DisplayAttribute_Name; } } \ No newline at end of file