diff --git a/Mvc.NoFun.sln b/Mvc.NoFun.sln index 33f4a84d2f..858650218f 100644 --- a/Mvc.NoFun.sln +++ b/Mvc.NoFun.sln @@ -35,7 +35,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Ta EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.TagHelpers.Test", "test\Microsoft.AspNetCore.Mvc.TagHelpers.Test\Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj", "{860119ED-3DB1-424D-8D0A-30132A8A7D96}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.TestCommon", "test\Microsoft.AspNetCore.Mvc.TestCommon\Microsoft.AspNetCore.Mvc.TestCommon.csproj", "{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Core.TestCommon", "test\Microsoft.AspNetCore.Mvc.Core.TestCommon\Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj", "{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.IntegrationTests", "test\Microsoft.AspNetCore.Mvc.IntegrationTests\Microsoft.AspNetCore.Mvc.IntegrationTests.csproj", "{864FA09D-1E48-403A-A6C8-4F079D2A30F0}" EndProject @@ -112,6 +112,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.An EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Analyzers.Test", "test\Microsoft.AspNetCore.Mvc.Analyzers.Test\Microsoft.AspNetCore.Mvc.Analyzers.Test.csproj", "{829D9A67-2D07-4CE6-86C0-59F2549B0CFA}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Views.TestCommon", "test\Microsoft.AspNetCore.Mvc.Views.TestCommon\Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj", "{0772E545-A674-4165-9469-E3D79D88A4A8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -546,6 +548,18 @@ Global {829D9A67-2D07-4CE6-86C0-59F2549B0CFA}.Release|Mixed Platforms.Build.0 = Release|Any CPU {829D9A67-2D07-4CE6-86C0-59F2549B0CFA}.Release|x86.ActiveCfg = Release|Any CPU {829D9A67-2D07-4CE6-86C0-59F2549B0CFA}.Release|x86.Build.0 = Release|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Debug|x86.ActiveCfg = Debug|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Debug|x86.Build.0 = Debug|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Release|Any CPU.Build.0 = Release|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Release|x86.ActiveCfg = Release|Any CPU + {0772E545-A674-4165-9469-E3D79D88A4A8}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -588,6 +602,7 @@ Global {30862895-C1FA-49F5-B69A-B0F9F2ECD0F3} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {F8FD2D6A-DCD1-4A7B-B599-B728A12A1754} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {829D9A67-2D07-4CE6-86C0-59F2549B0CFA} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} + {0772E545-A674-4165-9469-E3D79D88A4A8} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D003597F-372F-4068-A2F0-353BE3C3B39A} diff --git a/Mvc.sln b/Mvc.sln index da45132198..1eb7f54602 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -75,7 +75,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControllersFromServicesWebS EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControllersFromServicesClassLibrary", "test\WebSites\ControllersFromServicesClassLibrary\ControllersFromServicesClassLibrary.csproj", "{551DC89E-2A13-4CF2-83D7-1ADD802443D5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.TestCommon", "test\Microsoft.AspNetCore.Mvc.TestCommon\Microsoft.AspNetCore.Mvc.TestCommon.csproj", "{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Core.TestCommon", "test\Microsoft.AspNetCore.Mvc.Core.TestCommon\Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj", "{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CorsWebSite", "test\WebSites\CorsWebSite\CorsWebSite.csproj", "{94BA134D-04B3-48AA-BA55-5A4DB8640F2D}" EndProject @@ -170,6 +170,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.An EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorPagesClassLibrary", "test\WebSites\RazorPagesClassLibrary\RazorPagesClassLibrary.csproj", "{17122147-ADFD-41C8-87D9-CCC582CCA8F9}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Views.TestCommon", "test\Microsoft.AspNetCore.Mvc.Views.TestCommon\Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj", "{51E3E785-A9D1-4196-BAFE-A17FF4304B89}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -892,6 +894,18 @@ Global {17122147-ADFD-41C8-87D9-CCC582CCA8F9}.Release|Mixed Platforms.Build.0 = Release|Any CPU {17122147-ADFD-41C8-87D9-CCC582CCA8F9}.Release|x86.ActiveCfg = Release|Any CPU {17122147-ADFD-41C8-87D9-CCC582CCA8F9}.Release|x86.Build.0 = Release|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Debug|x86.ActiveCfg = Debug|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Debug|x86.Build.0 = Debug|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Release|Any CPU.Build.0 = Release|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Release|x86.ActiveCfg = Release|Any CPU + {51E3E785-A9D1-4196-BAFE-A17FF4304B89}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -961,6 +975,7 @@ Global {CBF23034-2249-4FE5-BD48-5F3CEAC0DF61} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {E83D3745-9BCF-40E8-8D34-AFBA604C2439} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {17122147-ADFD-41C8-87D9-CCC582CCA8F9} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} + {51E3E785-A9D1-4196-BAFE-A17FF4304B89} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {63D344F6-F86D-40E6-85B9-0AABBE338C4A} diff --git a/build/repo.props b/build/repo.props index 56142440e8..8156b45eaf 100644 --- a/build/repo.props +++ b/build/repo.props @@ -6,7 +6,8 @@ - + + diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Core/Properties/AssemblyInfo.cs index abaed09181..964f733284 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Properties/AssemblyInfo.cs @@ -4,7 +4,8 @@ using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Mvc.Formatters; +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Core.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.TestCommon, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Core.TestCommon, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] [assembly: TypeForwardedTo(typeof(InputFormatterException))] diff --git a/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj index 1ca6c1dee7..210346c189 100644 --- a/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Abstractions.Test/Microsoft.AspNetCore.Mvc.Abstractions.Test.csproj @@ -5,8 +5,7 @@ - - + diff --git a/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/DefaultApiDescriptionProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/DefaultApiDescriptionProviderTest.cs index d3f0110711..4ceafa6995 100644 --- a/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/DefaultApiDescriptionProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/DefaultApiDescriptionProviderTest.cs @@ -1744,7 +1744,7 @@ namespace Microsoft.AspNetCore.Mvc.Description { } - public class BaseProducesController : Controller + public class BaseProducesController : ControllerBase { public IActionResult ReturnsActionResult() { diff --git a/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj b/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj index 7a812822b1..3debef1228 100644 --- a/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test/Microsoft.AspNetCore.Mvc.ApiExplorer.Test.csproj @@ -5,7 +5,9 @@ - - + + + + diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs index 1904003bdd..c3f864b4d7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs @@ -454,49 +454,6 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts Assert.Equal(new[] { "ControllersAssembly", "MvcSandbox" }, candidates.Select(a => a.Name)); } - // This test verifies DefaultAssemblyPartDiscoveryProvider.ReferenceAssemblies reflects the actual loadable assemblies - // of the libraries that Microsoft.AspNetCore.Mvc depends on. - // If we add or remove dependencies, this test should be changed together. - [Fact] - public void ReferenceAssemblies_ReturnsLoadableReferenceAssemblies() - { - // Arrange - var excludeAssemblies = new string[] - { - "Microsoft.AspNetCore.Mvc.Core.Test", - "Microsoft.AspNetCore.Mvc.Razor.Extensions.Reference", - "Microsoft.AspNetCore.Mvc.TestCommon", - "Microsoft.AspNetCore.Mvc.TestDiagnosticListener", - "Microsoft.AspNetCore.Mvc.WebApiCompatShim", - }; - - var additionalAssemblies = new[] - { - // The following assemblies are not reachable from Microsoft.AspNetCore.Mvc - "Microsoft.AspNetCore.All", - "Microsoft.AspNetCore.Mvc.Formatters.Xml", - }; - - var dependencyContextLibraries = DependencyContext.Load(ThisAssembly) - .CompileLibraries - .Where(r => r.Name.StartsWith("Microsoft.AspNetCore.Mvc", StringComparison.OrdinalIgnoreCase) && - !excludeAssemblies.Contains(r.Name, StringComparer.OrdinalIgnoreCase)) - .Select(r => r.Name); - - var expected = dependencyContextLibraries - .Concat(additionalAssemblies) - .Distinct(StringComparer.OrdinalIgnoreCase) - .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); - - // Act - var referenceAssemblies = ApplicationAssembliesProvider - .ReferenceAssemblies - .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); - - // Assert - Assert.Equal(expected, referenceAssemblies, StringComparer.OrdinalIgnoreCase); - } - private class TestApplicationAssembliesProvider : ApplicationAssembliesProvider { public DependencyContext DependencyContext { get; set; } diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ContentResultTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ContentResultTest.cs index a9e878cc8f..6fd9433aa0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ContentResultTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ContentResultTest.cs @@ -9,8 +9,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Internal; -using Microsoft.AspNetCore.Mvc.TestCommon; -using Microsoft.AspNetCore.Mvc.ViewComponents; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -259,7 +257,7 @@ namespace Microsoft.AspNetCore.Mvc new ActionDescriptor()); } - private static IServiceCollection CreateServices(params ViewComponentDescriptor[] descriptors) + private static IServiceCollection CreateServices() { // An array pool could return a buffer which is greater or equal to the size of the default character // chunk size. Since the tests here depend on a specific character buffer size to test boundary conditions, diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ControllerBaseTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ControllerBaseTest.cs index f993e61803..d46f73d642 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ControllerBaseTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ControllerBaseTest.cs @@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.DependencyInjection; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcBuilderExtensionsTest.cs index 1aa3240f6f..4d1dbaec0d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcBuilderExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/MvcBuilderExtensionsTest.cs @@ -136,7 +136,7 @@ namespace Microsoft.AspNetCore.Mvc // independent. namespace Microsoft.AspNetCore.Mvc.MvcServiceCollectionExtensionsTestControllers { - public class ControllerTypeA : Microsoft.AspNetCore.Mvc.Controller + public class ControllerTypeA : ControllerBase { } diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/FileContentResultTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/FileContentResultTest.cs index e2d0dd087d..378422388b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/FileContentResultTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/FileContentResultTest.cs @@ -8,7 +8,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/FileStreamResultTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/FileStreamResultTest.cs index 081eaf7b81..bfb001a9bc 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/FileStreamResultTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/FileStreamResultTest.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/FormatFilterTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/FormatFilterTest.cs index b33698b52a..9610b485b4 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/FormatFilterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/FormatFilterTest.cs @@ -7,9 +7,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/FormatterMappingsTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/FormatterMappingsTest.cs index d5428abc3f..15252dc783 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/FormatterMappingsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Formatters/FormatterMappingsTest.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Testing; using Microsoft.Net.Http.Headers; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ObjectResultExecutorTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ObjectResultExecutorTest.cs index 2cf6981202..04013644df 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ObjectResultExecutorTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/ObjectResultExecutorTest.cs @@ -2,18 +2,14 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Formatters; -using Microsoft.AspNetCore.Mvc.Internal; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; -using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionMethodExecutorTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionMethodExecutorTest.cs index 6cd343dcd6..8e3f8c37e0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionMethodExecutorTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ActionMethodExecutorTest.cs @@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Internal var valueTask = actionMethodExecutor.Execute(mapper, objectMethodExecutor, controller, Array.Empty()); // Assert - Assert.IsType(valueTask.Result); + Assert.IsType(valueTask.Result); } [Fact] @@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Internal var valueTask = actionMethodExecutor.Execute(mapper, objectMethodExecutor, controller, Array.Empty()); // Assert - Assert.IsType(valueTask.Result); + Assert.IsType(valueTask.Result); } [Fact] @@ -166,7 +166,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Internal var valueTask = actionMethodExecutor.Execute(mapper, objectMethodExecutor, controller, Array.Empty()); // Assert - Assert.IsType(valueTask.Result); + Assert.IsType(valueTask.Result); } [Fact] @@ -183,7 +183,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Internal // Assert await valueTask; - Assert.IsType(valueTask.Result); + Assert.IsType(valueTask.Result); } [Fact] @@ -291,7 +291,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Internal public IActionResult ReturnIActionResult() => new ContentResult(); - public PartialViewResult ReturnsIActionResultSubType() => new PartialViewResult(); + public ContentResult ReturnsIActionResultSubType() => new ContentResult(); public ActionResult ReturnsActionResultOfT() => new ActionResult(new TestModel()); @@ -309,9 +309,9 @@ namespace Microsoft.AspNetCore.Mvc.Core.Internal return Task.CompletedTask; } - public Task ReturnIActionResultAsync() => Task.FromResult((IActionResult)new ViewResult()); + public Task ReturnIActionResultAsync() => Task.FromResult((IActionResult)new StatusCodeResult(201)); - public Task ReturnsIActionResultSubTypeAsync() => Task.FromResult(new ViewResult()); + public Task ReturnsIActionResultSubTypeAsync() => Task.FromResult(new StatusCodeResult(200)); public Task ReturnsModelAsModelAsync() => Task.FromResult(new TestModel()); diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ApiBehaviorApplicationModelProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ApiBehaviorApplicationModelProviderTest.cs index 5ce29079a1..b651874be8 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ApiBehaviorApplicationModelProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ApiBehaviorApplicationModelProviderTest.cs @@ -668,13 +668,13 @@ Environment.NewLine + "int b"; [ApiController] [Route("TestApi")] - private class TestApiController : Controller + private class TestApiController : ControllerBase { [HttpGet] public IActionResult TestAction() => null; } - private class SimpleController : Controller + private class SimpleController : ControllerBase { public IActionResult ActionWithoutFilter() => null; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorProviderTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorProviderTests.cs index 6fcaadbd27..56b44dc4fa 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorProviderTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerActionDescriptorProviderTests.cs @@ -2024,7 +2024,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal } } - private class UserController : Controller + private class UserController : ControllerBase { public string GetUser(int id) { diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultApplicationModelProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultApplicationModelProviderTest.cs index e052aed8aa..1090cc5868 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultApplicationModelProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultApplicationModelProviderTest.cs @@ -1243,7 +1243,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal } private class DerivedFromControllerAndExplicitIDisposableImplementationController - : Mvc.Controller, IDisposable + : ViewFeaturesController, IDisposable { void IDisposable.Dispose() { @@ -1251,7 +1251,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal } } - private class DerivedFromControllerAndHidesBaseDisposeMethodController : Mvc.Controller + private class DerivedFromControllerAndHidesBaseDisposeMethodController : ViewFeaturesController { public new void Dispose() { @@ -1259,6 +1259,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal } } + private class ViewFeaturesController : ControllerBase, IDisposable + { + public virtual void Dispose() + { + } + } + private class BaseClassWithAttributeRoutesController { [Route("A")] diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseContentTypeHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseContentTypeHelperTest.cs index 9e1e31edec..d7898089b8 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseContentTypeHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ResponseContentTypeHelperTest.cs @@ -2,8 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Text; -using Microsoft.AspNetCore.Mvc.Formatters; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.Net.Http.Headers; using Xunit; @@ -107,14 +105,12 @@ namespace Microsoft.AspNetCore.Mvc.Internal var defaultContentType = "text/default; p1=p1-value; charset=utf-8"; // Act - string resolvedContentType = null; - Encoding resolvedContentTypeEncoding = null; ResponseContentTypeHelper.ResolveContentTypeAndEncoding( contentType?.ToString(), responseContentType, defaultContentType, - out resolvedContentType, - out resolvedContentTypeEncoding); + out var resolvedContentType, + out var resolvedContentTypeEncoding); // Assert Assert.Equal(expectedContentType, resolvedContentType); @@ -128,14 +124,12 @@ namespace Microsoft.AspNetCore.Mvc.Internal var defaultContentType = "text/plain; charset=utf-8"; // Act - string resolvedContentType = null; - Encoding resolvedContentTypeEncoding = null; ResponseContentTypeHelper.ResolveContentTypeAndEncoding( null, expectedContentType, defaultContentType, - out resolvedContentType, - out resolvedContentTypeEncoding); + out var resolvedContentType, + out var resolvedContentTypeEncoding); // Assert Assert.Equal(expectedContentType, resolvedContentType); diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj index 25368d8cc0..aef0c4c3c4 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Microsoft.AspNetCore.Mvc.Core.Test.csproj @@ -10,14 +10,12 @@ - - + + + - - - diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/PhysicalFileResultTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/PhysicalFileResultTest.cs index 69dd1a4550..e6173fd070 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/PhysicalFileResultTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/PhysicalFileResultTest.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ProducesAttributeTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ProducesAttributeTests.cs index 49084a2c91..4c3e9ae7a3 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ProducesAttributeTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ProducesAttributeTests.cs @@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Formatters.Internal; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Primitives; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToPageResultTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToPageResultTest.cs index 40026e2130..17321fe0f6 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToPageResultTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/RedirectToPageResultTest.cs @@ -7,8 +7,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; -using Microsoft.AspNetCore.Mvc.Internal; -using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Testing; @@ -87,11 +85,11 @@ namespace Microsoft.AspNetCore.Mvc RequestServices = CreateServices(), }; - var pageContext = new PageContext + var pageContext = new ActionContext { HttpContext = httpContext, RouteData = new RouteData(), - ActionDescriptor = new CompiledPageActionDescriptor(), + ActionDescriptor = new ActionDescriptor(), }; pageContext.RouteData.Values.Add("page", "/A/Redirecting/Page"); @@ -144,7 +142,7 @@ namespace Microsoft.AspNetCore.Mvc RequestServices = CreateServices(), }; - var pageContext = new PageContext + var pageContext = new ActionContext { HttpContext = httpContext, RouteData = new RouteData(), diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/VirtualFileResultTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/VirtualFileResultTest.cs index 21a20fb637..e9aed292ab 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/VirtualFileResultTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/VirtualFileResultTest.cs @@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/CommonFilterTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/CommonFilterTest.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/CommonFilterTest.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/CommonFilterTest.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/CommonResourceInvokerTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/CommonResourceInvokerTest.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/CommonResourceInvokerTest.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/CommonResourceInvokerTest.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/MediaTypeAssert.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/MediaTypeAssert.cs similarity index 83% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/MediaTypeAssert.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/MediaTypeAssert.cs index bfd7576836..a6d16fc6f7 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/MediaTypeAssert.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/MediaTypeAssert.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; using Xunit.Sdk; -namespace Microsoft.AspNetCore.Mvc.TestCommon +namespace Microsoft.AspNetCore.Mvc { public class MediaTypeAssert { @@ -35,11 +35,8 @@ namespace Microsoft.AspNetCore.Mvc.TestCommon throw new EqualException(left.ToString(), right.ToString()); } - MediaTypeHeaderValue leftMediaType = null; - MediaTypeHeaderValue rightMediaType = null; - - if (!MediaTypeHeaderValue.TryParse(left.Value, out leftMediaType) || - !MediaTypeHeaderValue.TryParse(right.Value, out rightMediaType) || + if (!MediaTypeHeaderValue.TryParse(left.Value, out var leftMediaType) || + !MediaTypeHeaderValue.TryParse(right.Value, out var rightMediaType) || !leftMediaType.Equals(rightMediaType)) { throw new EqualException(left.ToString(), right.ToString()); diff --git a/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj new file mode 100644 index 0000000000..44d8da1323 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj @@ -0,0 +1,18 @@ + + + + $(StandardTestTfms) + + + + + + + + + + + + + + diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/NonSeekableReadableStream.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/NonSeekableReadableStream.cs similarity index 97% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/NonSeekableReadableStream.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/NonSeekableReadableStream.cs index b729dc6b68..b5ccd405ac 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/NonSeekableReadableStream.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/NonSeekableReadableStream.cs @@ -6,7 +6,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.Mvc.TestCommon +namespace Microsoft.AspNetCore.Mvc { public class NonSeekableReadStream : Stream { diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/SimpleValueProvider.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProvider.cs similarity index 96% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/SimpleValueProvider.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProvider.cs index a5e4fac206..cf0a95240c 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/SimpleValueProvider.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProvider.cs @@ -37,8 +37,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding public ValueProviderResult GetValue(string key) { - object rawValue; - if (TryGetValue(key, out rawValue)) + if (TryGetValue(key, out var rawValue)) { if (rawValue != null && rawValue.GetType().IsArray) { diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/SimpleValueProviderFactory.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProviderFactory.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/SimpleValueProviderFactory.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/SimpleValueProviderFactory.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestClientModelValidatorProvider.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestClientModelValidatorProvider.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestClientModelValidatorProvider.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestClientModelValidatorProvider.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpRequestStreamReaderFactory.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestHttpRequestStreamReaderFactory.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpRequestStreamReaderFactory.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestHttpRequestStreamReaderFactory.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpResponseStreamWriterFactory.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestHttpResponseStreamWriterFactory.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpResponseStreamWriterFactory.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestHttpResponseStreamWriterFactory.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestModelBinderFactory.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelBinderFactory.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestModelBinderFactory.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelBinderFactory.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestModelMetadataProvider.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelMetadataProvider.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestModelMetadataProvider.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelMetadataProvider.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestModelValidatorProvider.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelValidatorProvider.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestModelValidatorProvider.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/TestModelValidatorProvider.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/ValidationAttributeUtil.cs b/test/Microsoft.AspNetCore.Mvc.Core.TestCommon/ValidationAttributeUtil.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/ValidationAttributeUtil.cs rename to test/Microsoft.AspNetCore.Mvc.Core.TestCommon/ValidationAttributeUtil.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj index f73ee9967c..684e4dfcef 100644 --- a/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Cors.Test/Microsoft.AspNetCore.Mvc.Cors.Test.csproj @@ -6,10 +6,8 @@ - + - - diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/CompareAttributeAdapterTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/CompareAttributeAdapterTest.cs index 8466b511fb..ab3c4d0b5d 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/CompareAttributeAdapterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/CompareAttributeAdapterTest.cs @@ -1,10 +1,10 @@ // 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 System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Localization; @@ -26,16 +26,14 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var attribute = new CompareAttribute("OtherProperty"); var adapter = new CompareAttributeAdapter(attribute, stringLocalizer: null); - // Mono issue - https://github.com/aspnet/External/issues/19 - var expectedMessage = PlatformNormalizer.NormalizeContent( - "'MyPropertyDisplayName' and 'OtherPropertyDisplayName' do not match."); + var expectedMessage = "'MyPropertyDisplayName' and 'OtherPropertyDisplayName' do not match."; var actionContext = new ActionContext(); var context = new ClientModelValidationContext( actionContext, metadata, metadataProvider, - new AttributeDictionary()); + new Dictionary()); // Act adapter.AddValidation(context); @@ -78,7 +76,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal actionContext, metadata, metadataProvider, - new AttributeDictionary()); + new Dictionary()); // Act adapter.AddValidation(context); @@ -106,15 +104,14 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var attribute = new CompareAttribute("OtherProperty"); var adapter = new CompareAttributeAdapter(attribute, stringLocalizer: null); - // Mono issue - https://github.com/aspnet/External/issues/19 - var expectedMessage = PlatformNormalizer.NormalizeContent("'MyProperty' and 'OtherProperty' do not match."); + var expectedMessage = "'MyProperty' and 'OtherProperty' do not match."; var actionContext = new ActionContext(); var context = new ClientModelValidationContext( actionContext, metadata, metadataProvider, - new AttributeDictionary()); + new Dictionary()); // Act adapter.AddValidation(context); @@ -151,7 +148,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal actionContext, metadata, metadataProvider, - new AttributeDictionary()); + new Dictionary()); // Act adapter.AddValidation(context); @@ -191,7 +188,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal actionContext, metadata, metadataProvider, - new AttributeDictionary()); + new Dictionary()); // Act adapter.AddValidation(context); @@ -224,7 +221,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal actionContext, metadata, metadataProvider, - new AttributeDictionary()); + new Dictionary()); context.Attributes.Add("data-val", "original"); context.Attributes.Add("data-val-equalto", "original"); diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsMetadataProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsMetadataProviderTest.cs index ac90d1f155..ad36bec14c 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsMetadataProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/DataAnnotationsMetadataProviderTest.cs @@ -1315,12 +1315,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal { using (new CultureReplacer(string.Empty, string.Empty)) { - var hashcode = HashCodeCombiner.Start(); - - hashcode.Add(obj.Key.Name); - hashcode.Add(obj.Key.Group); - - return hashcode.CombinedHash; + return obj.Key.GetHashCode(); } } } diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/FileExtensionsAttributeAdapterTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/FileExtensionsAttributeAdapterTest.cs index 0cdb65c847..0bf66c965c 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/FileExtensionsAttributeAdapterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/FileExtensionsAttributeAdapterTest.cs @@ -1,9 +1,9 @@ // 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 System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Localization; using Moq; @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation var expectedErrorMessage = string.Format(attribute.ErrorMessage, nameof(Profile.PhotoFileName), formattedExtensions); var adapter = new FileExtensionsAttributeAdapter(attribute, stringLocalizer: null); - var context = new ClientModelValidationContext(new ActionContext(), metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(new ActionContext(), metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation var expectedErrorMessage = string.Format(attribute.ErrorMessage, nameof(Profile.PhotoFileName), formattedExtensions); var adapter = new FileExtensionsAttributeAdapter(attribute, stringLocalizer: null); - var context = new ClientModelValidationContext(new ActionContext(), metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(new ActionContext(), metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -117,7 +117,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation .Returns(new LocalizedString(attribute.ErrorMessage, expectedErrorMessage)); var adapter = new FileExtensionsAttributeAdapter(attribute, stringLocalizer: stringLocalizer.Object); - var context = new ClientModelValidationContext(new ActionContext(), metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(new ActionContext(), metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation attribute.ErrorMessage = "{0} expects only the following extensions: {1}"; var adapter = new FileExtensionsAttributeAdapter(attribute, stringLocalizer: null); - var context = new ClientModelValidationContext(new ActionContext(), metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(new ActionContext(), metadata, provider, new Dictionary()); context.Attributes.Add("data-val", "original"); context.Attributes.Add("data-val-fileextensions", "original"); diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MaxLengthAttributeAdapterTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MaxLengthAttributeAdapterTest.cs index 3b08753d71..b20d0a4518 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MaxLengthAttributeAdapterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MaxLengthAttributeAdapterTest.cs @@ -1,10 +1,10 @@ // 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 System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Localization; using Moq; @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new MaxLengthAttributeAdapter(attribute, stringLocalizer: stringLocalizer.Object); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var expectedMessage = attribute.FormatErrorMessage("Length"); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new MaxLengthAttributeAdapter(attribute, stringLocalizer: null); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new MaxLengthAttributeAdapter(attribute, stringLocalizer.Object); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -151,7 +151,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var expectedMessage = attribute.FormatErrorMessage("Length"); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); context.Attributes.Add("data-val", "original"); context.Attributes.Add("data-val-maxlength", "original"); diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MinLengthAttributeAdapterTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MinLengthAttributeAdapterTest.cs index 56d6d42efe..a559e00e3c 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MinLengthAttributeAdapterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/MinLengthAttributeAdapterTest.cs @@ -1,10 +1,10 @@ // 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 System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Localization; using Moq; @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new MinLengthAttributeAdapter(attribute, stringLocalizer: stringLocalizer.Object); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var expectedMessage = attribute.FormatErrorMessage("Length"); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var expectedMessage = "Array must have at least 2 items."; var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -116,7 +116,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new MinLengthAttributeAdapter(attribute, stringLocalizer: null); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); context.Attributes.Add("data-val", "original"); context.Attributes.Add("data-val-minlength", "original"); diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelValidationResultComparer.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelValidationResultComparer.cs index 289f30ec35..aafd2d3e60 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelValidationResultComparer.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/ModelValidationResultComparer.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal { @@ -34,11 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal throw new ArgumentNullException(nameof(obj)); } - var hashCodeCombiner = HashCodeCombiner.Start(); - hashCodeCombiner.Add(obj.MemberName, StringComparer.Ordinal); - hashCodeCombiner.Add(obj.Message, StringComparer.Ordinal); - - return hashCodeCombiner.CombinedHash; + return obj.MemberName.GetHashCode(); } } } diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/NumericClientModelValidatorTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/NumericClientModelValidatorTest.cs index 71e0b6adfb..581ccbf672 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/NumericClientModelValidatorTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/NumericClientModelValidatorTest.cs @@ -1,10 +1,10 @@ // 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 System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Xunit; @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new NumericClientModelValidator(); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); var expectedMessage = "The field DisplayId must be a number."; @@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new NumericClientModelValidator(); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new NumericClientModelValidator(); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new NumericClientModelValidator(); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new NumericClientModelValidator(); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); context.Attributes.Add("data-val", "original"); context.Attributes.Add("data-val-number", "original"); diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RangeAttributeAdapterTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RangeAttributeAdapterTest.cs index bbf5cf076b..626e915d0c 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RangeAttributeAdapterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RangeAttributeAdapterTest.cs @@ -1,9 +1,9 @@ // 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 System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Localization; using Moq; @@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation var adapter = new RangeAttributeAdapter(attribute, stringLocalizer: null); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation var adapter = new RangeAttributeAdapter(attribute, stringLocalizer: stringLocalizer.Object); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation var adapter = new RangeAttributeAdapter(attribute, stringLocalizer: null); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); context.Attributes.Add("data-val", "original"); context.Attributes.Add("data-val-range", "original"); diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RequiredAttributeAdapterTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RequiredAttributeAdapterTest.cs index 6dec6abfa7..3ea14c9586 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RequiredAttributeAdapterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/RequiredAttributeAdapterTest.cs @@ -1,10 +1,10 @@ // 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 System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Localization; using Moq; @@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new RequiredAttributeAdapter(attribute, stringLocalizer: stringLocalizer.Object); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new RequiredAttributeAdapter(attribute, stringLocalizer: null); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new RequiredAttributeAdapter(attribute, stringLocalizer: null); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); context.Attributes.Add("data-val", "original"); context.Attributes.Add("data-val-required", "original"); diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/StringLengthAttributeAdapterTest.cs b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/StringLengthAttributeAdapterTest.cs index 87c820dfe8..fdf8bf9186 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/StringLengthAttributeAdapterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Internal/StringLengthAttributeAdapterTest.cs @@ -1,10 +1,10 @@ // 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 System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Localization; using Moq; @@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var adapter = new StringLengthAttributeAdapter(attribute, stringLocalizer: stringLocalizer.Object); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -47,7 +47,6 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal kvp => { Assert.Equal("data-val", kvp.Key); Assert.Equal("true", kvp.Value); }, kvp => { Assert.Equal("data-val-length", kvp.Key); Assert.Equal(expectedMessage, kvp.Value); }, kvp => { Assert.Equal("data-val-length-max", kvp.Key); Assert.Equal("8", kvp.Value); }); - } [Fact] @@ -64,7 +63,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var expectedMessage = attribute.FormatErrorMessage("Length"); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -91,7 +90,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var expectedMessage = attribute.FormatErrorMessage("Length"); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -119,7 +118,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var expectedMessage = attribute.FormatErrorMessage("Length"); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); // Act adapter.AddValidation(context); @@ -145,7 +144,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal var expectedMessage = attribute.FormatErrorMessage("Length"); var actionContext = new ActionContext(); - var context = new ClientModelValidationContext(actionContext, metadata, provider, new AttributeDictionary()); + var context = new ClientModelValidationContext(actionContext, metadata, provider, new Dictionary()); context.Attributes.Add("data-val", "original"); context.Attributes.Add("data-val-length", "original"); diff --git a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj index 84e189a38e..b6673fbd95 100644 --- a/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test/Microsoft.AspNetCore.Mvc.DataAnnotations.Test.csproj @@ -5,10 +5,8 @@ - + - - diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonInputFormatterTest.cs b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonInputFormatterTest.cs index 0441961c2a..d17e4748fa 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonInputFormatterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonInputFormatterTest.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.ObjectPool; diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonPatchInputFormatterTest.cs b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonPatchInputFormatterTest.cs index dc097cd5c4..16961e2866 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonPatchInputFormatterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/JsonPatchInputFormatterTest.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.JsonPatch; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.ObjectPool; diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj index 4ace996ce7..4b93e7b0a3 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test/Microsoft.AspNetCore.Mvc.Formatters.Json.Test.csproj @@ -5,11 +5,9 @@ - + + - - - diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj index a02cf7ca47..b6673fbd95 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test.csproj @@ -5,9 +5,8 @@ - + - diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerInputFormatterTest.cs b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerInputFormatterTest.cs index 5edf2998e6..885e231a5a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerInputFormatterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlDataContractSerializerInputFormatterTest.cs @@ -11,7 +11,6 @@ using System.Xml; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerInputFormatterTest.cs b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerInputFormatterTest.cs index 84360e3c94..423edaaa20 100644 --- a/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerInputFormatterTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Formatters.Xml.Test/XmlSerializerInputFormatterTest.cs @@ -12,7 +12,6 @@ using System.Xml.Serialization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/ResourceFile.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Infrastructure/ResourceFile.cs similarity index 98% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/ResourceFile.cs rename to test/Microsoft.AspNetCore.Mvc.FunctionalTests/Infrastructure/ResourceFile.cs index f1128e0f66..97c51a0d6e 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/ResourceFile.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Infrastructure/ResourceFile.cs @@ -7,6 +7,7 @@ using System.IO; using System.Reflection; using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing; using Xunit; namespace Microsoft.AspNetCore.Mvc @@ -190,7 +191,8 @@ namespace Microsoft.AspNetCore.Mvc { // The build system compiles every file under the resources folder as a resource available at runtime // with the same name as the file name. Need to update this file on disc. - var projectPath = SolutionPathUtility.GetProjectPath("test", assembly); + var solutionPath = TestPathUtilities.GetSolutionRootDirectory("Mvc"); + var projectPath = Path.Combine(solutionPath, "test", assembly.GetName().Name); var fullPath = Path.Combine(projectPath, resourceName); WriteFile(fullPath, content); } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InputObjectValidationTests.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InputObjectValidationTests.cs index dbe25c6c92..6a038fe5a1 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InputObjectValidationTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/InputObjectValidationTests.cs @@ -91,12 +91,12 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); // Mono issue - https://github.com/aspnet/External/issues/29 - Assert.Equal(PlatformNormalizer.NormalizeContent( + Assert.Equal( "The field Id must be between 1 and 2000.," + "The field Name must be a string or array type with a minimum length of '5'.," + "The field Alias must be a string with a minimum length of 3 and a maximum length of 15.," + "The field Designation must match the regular expression " + - (TestPlatformHelper.IsMono ? "[0-9a-zA-Z]*." : "'[0-9a-zA-Z]*'.")), + "'[0-9a-zA-Z]*'.", await response.Content.ReadAsStringAsync()); } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj index 813e61ff85..d9bafa174e 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj @@ -1,13 +1,11 @@ - + $(StandardTestTfms) - $(DefineConstants);GENERATE_BASELINES $(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES - $(DefineConstants);FUNCTIONAL_TESTS @@ -26,6 +24,8 @@ + + @@ -35,8 +35,6 @@ - - @@ -51,10 +49,7 @@ - - - diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RemoteAttributeValidationTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RemoteAttributeValidationTest.cs index 5e1919c462..8d5064bd49 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RemoteAttributeValidationTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RemoteAttributeValidationTest.cs @@ -45,9 +45,8 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests #if GENERATE_BASELINES ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent); #else - // Mono issue - https://github.com/aspnet/External/issues/19 Assert.Equal( - PlatformNormalizer.NormalizeContent(expectedContent), + expectedContent, responseContent, ignoreLineEndingDifferences: true); #endif diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/TagHelpersTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/TagHelpersTest.cs index b3c4d051aa..9c807942ea 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/TagHelpersTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/TagHelpersTest.cs @@ -116,9 +116,8 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent); #else expectedContent = string.Format(expectedContent, forgeryToken); - // Mono issue - https://github.com/aspnet/External/issues/19 Assert.Equal( - PlatformNormalizer.NormalizeContent(expectedContent.Trim()), + expectedContent.Trim(), responseContent, ignoreLineEndingDifferences: true); #endif @@ -217,9 +216,8 @@ page:root-content" #if GENERATE_BASELINES ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent); #else - // Mono issue - https://github.com/aspnet/External/issues/19 Assert.Equal( - PlatformNormalizer.NormalizeContent(expectedContent), + expectedContent, responseContent, ignoreLineEndingDifferences: true); #endif @@ -285,9 +283,8 @@ page:root-content" #if GENERATE_BASELINES ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent); #else - // Mono issue - https://github.com/aspnet/External/issues/19 Assert.Equal( - PlatformNormalizer.NormalizeContent(expectedContent), + expectedContent, responseContent, ignoreLineEndingDifferences: true); #endif diff --git a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/AuthorizeFilterIntegrationTest.cs b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/AuthorizeFilterIntegrationTest.cs index f19a67d45b..1134aa2f73 100644 --- a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/AuthorizeFilterIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/AuthorizeFilterIntegrationTest.cs @@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; using Xunit; @@ -78,7 +79,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests serviceCollection.AddAuthorization(); serviceCollection.AddMvc(); serviceCollection - .AddTransient() + .AddSingleton(NullLoggerFactory.Instance) .AddTransient, Logger>() .AddSingleton(); return serviceCollection.BuildServiceProvider(); diff --git a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/Microsoft.AspNetCore.Mvc.IntegrationTests.csproj b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/Microsoft.AspNetCore.Mvc.IntegrationTests.csproj index 8e52e2a34f..875d606d3e 100644 --- a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/Microsoft.AspNetCore.Mvc.IntegrationTests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/Microsoft.AspNetCore.Mvc.IntegrationTests.csproj @@ -6,9 +6,8 @@ - + - diff --git a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/ModelBindingTestHelper.cs b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/ModelBindingTestHelper.cs index 6aa9da7cf0..afd6b0ca40 100644 --- a/test/Microsoft.AspNetCore.Mvc.IntegrationTests/ModelBindingTestHelper.cs +++ b/test/Microsoft.AspNetCore.Mvc.IntegrationTests/ModelBindingTestHelper.cs @@ -189,7 +189,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); serviceCollection .AddSingleton() - .AddTransient() + .AddSingleton(NullLoggerFactory.Instance) .AddTransient, Logger>(); if (updateOptions != null) diff --git a/test/Microsoft.AspNetCore.Mvc.Localization.Test/Microsoft.AspNetCore.Mvc.Localization.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Localization.Test/Microsoft.AspNetCore.Mvc.Localization.Test.csproj index 1ca6c1dee7..faf5a9a84a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Localization.Test/Microsoft.AspNetCore.Mvc.Localization.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Localization.Test/Microsoft.AspNetCore.Mvc.Localization.Test.csproj @@ -5,10 +5,8 @@ - - - - + + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/DependencyInjection/MvcRazorMvcBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/DependencyInjection/MvcRazorMvcBuilderExtensionsTest.cs index eecee7664c..858de6a312 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/DependencyInjection/MvcRazorMvcBuilderExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/DependencyInjection/MvcRazorMvcBuilderExtensionsTest.cs @@ -1,13 +1,11 @@ // 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 System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.Razor.Internal; using Microsoft.AspNetCore.Mvc.Razor.TagHelpers; -using Microsoft.AspNetCore.Razor.Runtime.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.Extensions.DependencyInjection; using Xunit; @@ -21,12 +19,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Test.DependencyInjection { // Arrange var services = new ServiceCollection(); - var builder = services - .AddMvc() - .ConfigureApplicationPartManager(manager => - { - manager.ApplicationParts.Add(new TestApplicationPart()); - }); + + var manager = new ApplicationPartManager(); + manager.ApplicationParts.Add(new TestApplicationPart()); + + var builder = new MvcBuilder(services, manager); // Act builder.AddTagHelpersAsServices(); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorPagePropertyActivatorTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorPagePropertyActivatorTest.cs index c0221fc68d..c1c68a7d8d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorPagePropertyActivatorTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorPagePropertyActivatorTest.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal var activator = new RazorPagePropertyActivator( typeof(TestPage), typeof(TestModel), - new TestModelMetadataProvider(), + new EmptyModelMetadataProvider(), propertyValueAccessors: null); var viewContext = new ViewContext(); @@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal var activator = new RazorPagePropertyActivator( typeof(TestPage), declaredModelType: null, - metadataProvider: new TestModelMetadataProvider(), + metadataProvider: new EmptyModelMetadataProvider(), propertyValueAccessors: null); var viewContext = new ViewContext(); @@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal public void CreateViewDataDictionary_CreatesNestedViewDataDictionary_WhenContextInstanceIsNonGeneric() { // Arrange - var modelMetadataProvider = new TestModelMetadataProvider(); + var modelMetadataProvider = new EmptyModelMetadataProvider(); var activator = new RazorPagePropertyActivator( typeof(TestPage), declaredModelType: typeof(TestModel), @@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal public void CreateViewDataDictionary_UsesDeclaredTypeOverModelType_WhenCreatingTheViewDataDictionary() { // Arrange - var modelMetadataProvider = new TestModelMetadataProvider(); + var modelMetadataProvider = new EmptyModelMetadataProvider(); var activator = new RazorPagePropertyActivator( typeof(TestPage), declaredModelType: typeof(TestModel), @@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal public void CreateViewDataDictionary_CreatesNestedViewDataDictionary_WhenModelTypeDoesNotMatch() { // Arrange - var modelMetadataProvider = new TestModelMetadataProvider(); + var modelMetadataProvider = new EmptyModelMetadataProvider(); var activator = new RazorPagePropertyActivator( typeof(TestPage), declaredModelType: typeof(TestModel), @@ -139,7 +139,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal public void CreateViewDataDictionary_CreatesNestedViewDataDictionary_WhenNullModelTypeDoesNotMatch() { // Arrange - var modelMetadataProvider = new TestModelMetadataProvider(); + var modelMetadataProvider = new EmptyModelMetadataProvider(); var activator = new RazorPagePropertyActivator( typeof(TestPage), declaredModelType: null, @@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal public void CreateViewDataDictionary_ReturnsInstanceOnContext_IfModelTypeMatches() { // Arrange - var modelMetadataProvider = new TestModelMetadataProvider(); + var modelMetadataProvider = new EmptyModelMetadataProvider(); var activator = new RazorPagePropertyActivator( typeof(TestPage), declaredModelType: typeof(TestModel), @@ -195,7 +195,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal public void CreateViewDataDictionary_ReturnsInstanceOnContext_WithNullModelType() { // Arrange - var modelMetadataProvider = new TestModelMetadataProvider(); + var modelMetadataProvider = new EmptyModelMetadataProvider(); var activator = new RazorPagePropertyActivator( typeof(TestPage), declaredModelType: null, diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorViewCompilerTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorViewCompilerTest.cs index 929bf63b93..21840806ba 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorViewCompilerTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorViewCompilerTest.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Emit; using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Microsoft.AspNetCore.Mvc.Razor.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Microsoft.AspNetCore.Mvc.Razor.Test.csproj index 88f06a4cbb..2cee7fa108 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Microsoft.AspNetCore.Mvc.Razor.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Microsoft.AspNetCore.Mvc.Razor.Test.csproj @@ -11,13 +11,11 @@ - - + + - - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorPageCreateModelExpressionTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorPageCreateModelExpressionTest.cs index b16c2fe500..015742b0c3 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorPageCreateModelExpressionTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorPageCreateModelExpressionTest.cs @@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor private static IModelExpressionProvider CreateModelExpressionProvider() { - var provider = new TestModelMetadataProvider(); + var provider = new EmptyModelMetadataProvider(); var modelExpressionProvider = new ModelExpressionProvider( provider, new ExpressionTextCache()); @@ -219,7 +219,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor private static ViewContext CreateViewContext() { - var provider = new TestModelMetadataProvider(); + var provider = new EmptyModelMetadataProvider(); var viewData = new ViewDataDictionary(provider, new ModelStateDictionary()); var serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton(provider); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorPageTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorPageTest.cs index 0484a805eb..2d7ba2df96 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorPageTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorPageTest.cs @@ -14,7 +14,6 @@ using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Routing; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineOptionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineOptionsTest.cs index 6172036b6c..30197bae76 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineOptionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineOptionsTest.cs @@ -6,6 +6,7 @@ using System.Linq; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Options; using Xunit; @@ -94,4 +95,4 @@ namespace Microsoft.AspNetCore.Mvc.Razor Assert.Same(fileProvider, accessor.Value.FileProviders[0]); } } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineTest.cs index 378ca51d42..be418aa7e3 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewEngineTest.cs @@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Testing; using Microsoft.Extensions.Options; diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/TagHelpers/UrlResolutionTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/TagHelpers/UrlResolutionTagHelperTest.cs index 84db2e9a8e..0eab7b1331 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/TagHelpers/UrlResolutionTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/TagHelpers/UrlResolutionTagHelperTest.cs @@ -7,9 +7,7 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Html; -using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Routing; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.Extensions.WebEncoders.Testing; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Internal/PageActionInvokerProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Internal/PageActionInvokerProviderTest.cs index b2d6aa0186..955149bf03 100644 --- a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Internal/PageActionInvokerProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Internal/PageActionInvokerProviderTest.cs @@ -15,12 +15,12 @@ using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.Razor.Compilation; -using Microsoft.AspNetCore.Mvc.Razor.Internal; using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Microsoft.AspNetCore.Mvc.RazorPages.Test.csproj b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Microsoft.AspNetCore.Mvc.RazorPages.Test.csproj index 26a80f2c7a..64835957ec 100644 --- a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Microsoft.AspNetCore.Mvc.RazorPages.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Microsoft.AspNetCore.Mvc.RazorPages.Test.csproj @@ -6,12 +6,10 @@ - + - - diff --git a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/PageModelTest.cs b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/PageModelTest.cs index b73abd57b9..b3443d36c1 100644 --- a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/PageModelTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/PageModelTest.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure; using Microsoft.AspNetCore.Mvc.Routing; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Testing; diff --git a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/PageTest.cs b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/PageTest.cs index f253c06d43..60d9cc7884 100644 --- a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/PageTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/PageTest.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; using Microsoft.AspNetCore.Routing; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs index 11fbbe5d0a..903a335451 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs @@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Routing; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/InputTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/InputTagHelperTest.cs index 79e44651b3..ce787ccf14 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/InputTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/InputTagHelperTest.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; using Microsoft.AspNetCore.Razor.TagHelpers; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LabelTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LabelTagHelperTest.cs index 3d4e171a6f..106af2e50c 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LabelTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LabelTagHelperTest.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs index 1c18cf70cf..ed843fe9e6 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs @@ -12,11 +12,9 @@ using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Mvc.TagHelpers.Internal; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj index d9c1634c3c..b9c56ca6de 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/Microsoft.AspNetCore.Mvc.TagHelpers.Test.csproj @@ -6,12 +6,9 @@ - + - - - diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/PartialTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/PartialTagHelperTest.cs index d1f0e16ee1..21ac445239 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/PartialTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/PartialTagHelperTest.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs index 7abb469556..97a4214606 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs @@ -12,11 +12,9 @@ using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Mvc.TagHelpers.Internal; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/SelectTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/SelectTagHelperTest.cs index dd41bb306b..8b8f842669 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/SelectTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/SelectTagHelperTest.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.TagHelpers.Internal; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Testing; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TagHelperOutputExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TagHelperOutputExtensionsTest.cs index 2c1cc87c07..8491d2c142 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TagHelperOutputExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TagHelperOutputExtensionsTest.cs @@ -5,13 +5,12 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Html; +using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers.Testing; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.WebEncoders.Testing; -using Microsoft.AspNetCore.Mvc.TestCommon; using Xunit; namespace Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TextAreaTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TextAreaTagHelperTest.cs index 614ceb985a..98f32a8050 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TextAreaTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TextAreaTagHelperTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Testing; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationSummaryTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationSummaryTagHelperTest.cs index 1b4ec3cc80..fec670ba58 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationSummaryTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationSummaryTagHelperTest.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; diff --git a/test/Microsoft.AspNetCore.Mvc.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs new file mode 100644 index 0000000000..9213836156 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Test/ApplicationParts/ApplicationAssembliesProviderTest.cs @@ -0,0 +1,56 @@ +// 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 System; +using System.Linq; +using System.Reflection; +using Microsoft.Extensions.DependencyModel; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.ApplicationParts +{ + public class ApplicationAssembliesProviderTest + { + private static readonly Assembly ThisAssembly = typeof(ApplicationAssembliesProviderTest).Assembly; + + // This test verifies ApplicationAssembliesProviderTest.ReferenceAssemblies reflects the actual loadable assemblies + // of the libraries that Microsoft.AspNetCore.Mvc depends on. + // If we add or remove dependencies, this test should be changed together. + [Fact] + public void ReferenceAssemblies_ReturnsLoadableReferenceAssemblies() + { + // Arrange + var excludeAssemblies = new string[] + { + "Microsoft.AspNetCore.Mvc.Test", + "Microsoft.AspNetCore.Mvc.Core.TestCommon", + }; + + var additionalAssemblies = new[] + { + // The following assemblies are not reachable from Microsoft.AspNetCore.Mvc + "Microsoft.AspNetCore.All", + "Microsoft.AspNetCore.Mvc.Formatters.Xml", + }; + + var dependencyContextLibraries = DependencyContext.Load(ThisAssembly) + .CompileLibraries + .Where(r => r.Name.StartsWith("Microsoft.AspNetCore.Mvc", StringComparison.OrdinalIgnoreCase) && + !excludeAssemblies.Contains(r.Name, StringComparer.OrdinalIgnoreCase)) + .Select(r => r.Name); + + var expected = dependencyContextLibraries + .Concat(additionalAssemblies) + .Distinct(StringComparer.OrdinalIgnoreCase) + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); + + // Act + var referenceAssemblies = ApplicationAssembliesProvider + .ReferenceAssemblies + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); + + // Assert + Assert.Equal(expected, referenceAssemblies, StringComparer.OrdinalIgnoreCase); + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Test/Microsoft.AspNetCore.Mvc.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Test/Microsoft.AspNetCore.Mvc.Test.csproj index 90beaff56b..6e674cf924 100644 --- a/test/Microsoft.AspNetCore.Mvc.Test/Microsoft.AspNetCore.Mvc.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Test/Microsoft.AspNetCore.Mvc.Test.csproj @@ -2,14 +2,17 @@ $(StandardTestTfms) + true + + + + - - diff --git a/test/Microsoft.AspNetCore.Mvc.Test/xunit.runner.json b/test/Microsoft.AspNetCore.Mvc.Test/xunit.runner.json new file mode 100644 index 0000000000..1c72a421ad --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Test/xunit.runner.json @@ -0,0 +1,3 @@ +{ + "shadowCopy": false +} diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/Microsoft.AspNetCore.Mvc.TestCommon.csproj b/test/Microsoft.AspNetCore.Mvc.TestCommon/Microsoft.AspNetCore.Mvc.TestCommon.csproj deleted file mode 100644 index 203c301faa..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/Microsoft.AspNetCore.Mvc.TestCommon.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - $(StandardTestTfms) - - - - - - - - - - - - - - - - - - - diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/PlatformNormalizer.cs b/test/Microsoft.AspNetCore.Mvc.TestCommon/PlatformNormalizer.cs deleted file mode 100644 index 3c8737c9b9..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/PlatformNormalizer.cs +++ /dev/null @@ -1,44 +0,0 @@ -// 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 System.Collections.Generic; -using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Testing; - -namespace Microsoft.AspNetCore.Mvc -{ - public static class PlatformNormalizer - { - // Mono issue - https://github.com/aspnet/External/issues/19 - public static string NormalizeContent(string input) - { - if (TestPlatformHelper.IsMono) - { - var equivalents = new Dictionary { - { - "The [0-9a-zA-Z ]+ field is required.", "RequiredAttribute_ValidationError" - }, - { - "'[0-9a-zA-Z ]+' and '[0-9a-zA-Z ]+' do not match.", "CompareAttribute_MustMatch" - }, - { - "The field [0-9a-zA-Z ]+ must be a string with a minimum length of [0-9]+ and a " + - "maximum length of [0-9]+.", - "StringLengthAttribute_ValidationErrorIncludingMinimum" - }, - }; - - var result = input; - - foreach (var kvp in equivalents) - { - result = Regex.Replace(result, kvp.Key, kvp.Value); - } - - return result; - } - - return input; - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/SolutionPathUtility.cs b/test/Microsoft.AspNetCore.Mvc.TestCommon/SolutionPathUtility.cs deleted file mode 100644 index a3d372fbf2..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/SolutionPathUtility.cs +++ /dev/null @@ -1,44 +0,0 @@ -// 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 System; -using System.IO; -using System.Reflection; - -namespace Microsoft.AspNetCore.Mvc -{ - public static class SolutionPathUtility - { - private const string SolutionName = "Mvc.sln"; - - /// - /// Gets the full path to the project. - /// - /// - /// The parent directory of the project. - /// e.g. samples, test, or test/Websites - /// - /// The project's assembly. - /// The full path to the project. - public static string GetProjectPath(string solutionRelativePath, Assembly assembly) - { - var projectName = assembly.GetName().Name; - var applicationBasePath = AppContext.BaseDirectory; - - var directoryInfo = new DirectoryInfo(applicationBasePath); - do - { - var solutionFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, SolutionName)); - if (solutionFileInfo.Exists) - { - return Path.GetFullPath(Path.Combine(directoryInfo.FullName, solutionRelativePath, projectName)); - } - - directoryInfo = directoryInfo.Parent; - } - while (directoryInfo.Parent != null); - - throw new Exception($"Solution root could not be located using application root {applicationBasePath}."); - } - } -} diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/DependencyInjection/MvcViewFeaturesMvcBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/DependencyInjection/MvcViewFeaturesMvcBuilderExtensionsTest.cs index e8c04b1370..862d5e4ffc 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/DependencyInjection/MvcViewFeaturesMvcBuilderExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/DependencyInjection/MvcViewFeaturesMvcBuilderExtensionsTest.cs @@ -20,20 +20,20 @@ namespace Microsoft.Extensions.DependencyInjection public void AddViewComponentsAsServices_ReplacesViewComponentActivator() { // Arrange - var services = new ServiceCollection(); - var builder = services - .AddMvc() - .ConfigureApplicationPartManager(manager => - { - manager.ApplicationParts.Add(new TestApplicationPart()); - manager.FeatureProviders.Add(new ViewComponentFeatureProvider()); - }); + var builder = CreateBuilder(); + + MvcViewFeaturesMvcCoreBuilderExtensions.AddViewServices(builder.Services); + builder.ConfigureApplicationPartManager(manager => + { + manager.ApplicationParts.Add(new TestApplicationPart()); + manager.FeatureProviders.Add(new ViewComponentFeatureProvider()); + }); // Act builder.AddViewComponentsAsServices(); // Assert - var descriptor = Assert.Single(services.ToList(), d => d.ServiceType == typeof(IViewComponentActivator)); + var descriptor = Assert.Single(builder.Services.ToList(), d => d.ServiceType == typeof(IViewComponentActivator)); Assert.Equal(typeof(ServiceBasedViewComponentActivator), descriptor.ImplementationType); } @@ -41,14 +41,13 @@ namespace Microsoft.Extensions.DependencyInjection public void AddCookieTempDataProvider_RegistersExpectedTempDataProvider() { // Arrange - var services = new ServiceCollection(); - var builder = services.AddMvc(); + var builder = CreateBuilder(); // Act builder.AddCookieTempDataProvider(); // Assert - var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); + var descriptor = Assert.Single(builder.Services, item => item.ServiceType == typeof(ITempDataProvider)); Assert.Equal(typeof(CookieTempDataProvider), descriptor.ImplementationType); } @@ -56,15 +55,14 @@ namespace Microsoft.Extensions.DependencyInjection public void AddCookieTempDataProvider_DoesNotRegisterOptionsConfiguration() { // Arrange - var services = new ServiceCollection(); - var builder = services.AddMvc(); + var builder = CreateBuilder(); // Act builder.AddCookieTempDataProvider(); // Assert Assert.DoesNotContain( - services, + builder.Services, item => item.ServiceType == typeof(IConfigureOptions)); } @@ -72,14 +70,13 @@ namespace Microsoft.Extensions.DependencyInjection public void AddCookieTempDataProviderWithSetupAction_RegistersExpectedTempDataProvider() { // Arrange - var services = new ServiceCollection(); - var builder = services.AddMvc(); + var builder = CreateBuilder(); // Act builder.AddCookieTempDataProvider(options => { }); // Assert - var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); + var descriptor = Assert.Single(builder.Services, item => item.ServiceType == typeof(ITempDataProvider)); Assert.Equal(typeof(CookieTempDataProvider), descriptor.ImplementationType); } @@ -87,15 +84,14 @@ namespace Microsoft.Extensions.DependencyInjection public void AddCookieTempDataProviderWithSetupAction_RegistersOptionsConfiguration() { // Arrange - var services = new ServiceCollection(); - var builder = services.AddMvc(); + var builder = CreateBuilder(); // Act builder.AddCookieTempDataProvider(options => { }); // Assert Assert.Single( - services, + builder.Services, item => item.ServiceType == typeof(IConfigureOptions)); } @@ -103,15 +99,14 @@ namespace Microsoft.Extensions.DependencyInjection public void AddCookieTempDataProvider_RegistersExpectedTempDataProvider_IfCalledTwice() { // Arrange - var services = new ServiceCollection(); - var builder = services.AddMvc(); + var builder = CreateBuilder(); // Act builder.AddCookieTempDataProvider(); builder.AddCookieTempDataProvider(); // Assert - var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); + var descriptor = Assert.Single(builder.Services, item => item.ServiceType == typeof(ITempDataProvider)); Assert.Equal(typeof(CookieTempDataProvider), descriptor.ImplementationType); } @@ -119,15 +114,14 @@ namespace Microsoft.Extensions.DependencyInjection public void AddCookieTempDataProviderWithSetupAction_RegistersExpectedTempDataProvider_IfCalledTwice() { // Arrange - var services = new ServiceCollection(); - var builder = services.AddMvc(); + var builder = CreateBuilder(); // Act builder.AddCookieTempDataProvider(options => { }); builder.AddCookieTempDataProvider(options => { }); // Assert - var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); + var descriptor = Assert.Single(builder.Services, item => item.ServiceType == typeof(ITempDataProvider)); Assert.Equal(typeof(CookieTempDataProvider), descriptor.ImplementationType); } @@ -166,6 +160,14 @@ namespace Microsoft.Extensions.DependencyInjection Assert.Equal(ServiceLifetime.Singleton, collection[2].Lifetime); } + private static MvcBuilder CreateBuilder() + { + var services = new ServiceCollection(); + var manager = new ApplicationPartManager(); + var builder = new MvcBuilder(services, manager); + return builder; + } + public class ConventionsViewComponent { public string Invoke() => "Hello world"; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/DefaultDisplayTemplatesTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/DefaultDisplayTemplatesTest.cs index bf9c3446ca..73e3b0cc08 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/DefaultDisplayTemplatesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/DefaultDisplayTemplatesTest.cs @@ -10,7 +10,6 @@ using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/DefaultEditorTemplatesTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/DefaultEditorTemplatesTest.cs index 793f7a176e..30f7f4d0da 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/DefaultEditorTemplatesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/DefaultEditorTemplatesTest.cs @@ -14,7 +14,6 @@ using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Testing; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test.csproj b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test.csproj index f3dea58d26..eb45ca869d 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test.csproj @@ -5,11 +5,7 @@ - - + - - - diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperCheckboxTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperCheckboxTest.cs index 6f56ab6dde..67cfb7f64e 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperCheckboxTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperCheckboxTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.IO; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Testing; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayExtensionsTest.cs index c32e06c3bf..c53a3eaf56 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayExtensionsTest.cs @@ -5,7 +5,6 @@ using System; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.Extensions.Localization; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDropDownListExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDropDownListExtensionsTest.cs index b7d1846b0b..a465269d9b 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDropDownListExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDropDownListExtensionsTest.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperEditorExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperEditorExtensionsTest.cs index a73fc44a2f..9a8365805f 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperEditorExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperEditorExtensionsTest.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperHiddenTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperHiddenTest.cs index 2829b1746d..738a0fe051 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperHiddenTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperHiddenTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq.Expressions; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLabelExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLabelExtensionsTest.cs index 95c8d3a38a..1c1a1861e6 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLabelExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLabelExtensionsTest.cs @@ -4,7 +4,6 @@ using System; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLinkGenerationTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLinkGenerationTest.cs index 3339241361..be91f77692 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLinkGenerationTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLinkGenerationTest.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc.Routing; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.Extensions.Internal; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperListBoxExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperListBoxExtensionsTest.cs index d5277ae2bd..1a2c4d6d4b 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperListBoxExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperListBoxExtensionsTest.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPartialExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPartialExtensionsTest.cs index 23944cc16e..f795adcf2b 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPartialExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPartialExtensionsTest.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPasswordTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPasswordTest.cs index f951e13c9f..61465fe48e 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPasswordTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPasswordTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq.Expressions; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperRadioButtonExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperRadioButtonExtensionsTest.cs index ce3b3ca7fe..cbfb61c7bf 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperRadioButtonExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperRadioButtonExtensionsTest.cs @@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperSelectTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperSelectTest.cs index 9a0d279ffe..56ddb2c7a2 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperSelectTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperSelectTest.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.Linq; using System.Text.Encodings.Web; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextAreaExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextAreaExtensionsTest.cs index 2f30e0f551..b5bd004a48 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextAreaExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextAreaExtensionsTest.cs @@ -4,7 +4,6 @@ using System; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextAreaTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextAreaTest.cs index 1e5d51fc1c..a125cc250d 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextAreaTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextAreaTest.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq.Expressions; -using Microsoft.AspNetCore.Mvc.TestCommon; using Xunit; namespace Microsoft.AspNetCore.Mvc.Rendering diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextBoxExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextBoxExtensionsTest.cs index 700f9fbf4c..64444999a6 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextBoxExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextBoxExtensionsTest.cs @@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextBoxTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextBoxTest.cs index 82b5710fde..16d0b0e2f0 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextBoxTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTextBoxTest.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq.Expressions; -using Microsoft.AspNetCore.Mvc.TestCommon; using Xunit; namespace Microsoft.AspNetCore.Mvc.Rendering diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationMessageExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationMessageExtensionsTest.cs index b9e1f5fc4f..6bf8c50b65 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationMessageExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationMessageExtensionsTest.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Xunit; namespace Microsoft.AspNetCore.Mvc.Core diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs index 5531f4da05..28b6ad4c86 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs @@ -7,7 +7,6 @@ using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Xunit; namespace Microsoft.AspNetCore.Mvc.Rendering diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs index ce76a6c786..0132887614 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.IO; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.Extensions.WebEncoders.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs index 1744a3380b..fcb0c7c92c 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs @@ -12,10 +12,9 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; -using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.Infrastructure; +using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewComponents; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/AntiforgeryExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/AntiforgeryExtensionsTest.cs index d3b57ffb7d..9123aeed3e 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/AntiforgeryExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/AntiforgeryExtensionsTest.cs @@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc.TestCommon; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs index c8c7198ad9..d4e5477aab 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs @@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Routing; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Testing; diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/ViewExecutorTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/ViewExecutorTest.cs index 12be821f84..f55d3a91fd 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/ViewExecutorTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/ViewExecutorTest.cs @@ -11,10 +11,8 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Microsoft.Net.Http.Headers; diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/HtmlContentUtilities.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/HtmlContentUtilities.cs similarity index 94% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/HtmlContentUtilities.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/HtmlContentUtilities.cs index 0f7c7aca6e..b828223c65 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/HtmlContentUtilities.cs +++ b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/HtmlContentUtilities.cs @@ -6,7 +6,7 @@ using System.Text.Encodings.Web; using Microsoft.AspNetCore.Html; using Microsoft.Extensions.WebEncoders.Testing; -namespace Microsoft.AspNetCore.Mvc.TestCommon +namespace Microsoft.AspNetCore.Mvc { public class HtmlContentUtilities { diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/HtmlGeneratorUtilities.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/HtmlGeneratorUtilities.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/HtmlGeneratorUtilities.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/HtmlGeneratorUtilities.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj new file mode 100644 index 0000000000..f098adae0f --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj @@ -0,0 +1,18 @@ + + + + $(StandardTestTfms) + + + + + + + + + + + + + + diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestDirectoryContent.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestDirectoryContent.cs similarity index 92% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestDirectoryContent.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestDirectoryContent.cs index 0ddb4f7823..476a59ef2d 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestDirectoryContent.cs +++ b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestDirectoryContent.cs @@ -5,9 +5,8 @@ using System; using System.Collections; using System.Collections.Generic; using System.IO; -using Microsoft.Extensions.FileProviders; -namespace Microsoft.AspNetCore.Mvc.TestCommon +namespace Microsoft.Extensions.FileProviders { public class TestDirectoryContent : IDirectoryContents, IFileInfo { diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestDirectoryFileInfo.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestDirectoryFileInfo.cs similarity index 86% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestDirectoryFileInfo.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestDirectoryFileInfo.cs index 4183025503..8d2a05e29f 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestDirectoryFileInfo.cs +++ b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestDirectoryFileInfo.cs @@ -3,10 +3,8 @@ using System; using System.IO; -using System.Text; -using Microsoft.Extensions.FileProviders; -namespace Microsoft.AspNetCore.Mvc.Razor +namespace Microsoft.Extensions.FileProviders { public class TestDirectoryFileInfo : IFileInfo { diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestFileChangeToken.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestFileChangeToken.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestFileChangeToken.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestFileChangeToken.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestFileInfo.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestFileInfo.cs similarity index 92% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestFileInfo.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestFileInfo.cs index 79b2f94c4f..9545c36d5e 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestFileInfo.cs +++ b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestFileInfo.cs @@ -4,9 +4,8 @@ using System; using System.IO; using System.Text; -using Microsoft.Extensions.FileProviders; -namespace Microsoft.AspNetCore.Mvc.Razor +namespace Microsoft.Extensions.FileProviders { public class TestFileInfo : IFileInfo { diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestFileProvider.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestFileProvider.cs similarity index 97% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestFileProvider.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestFileProvider.cs index 3e3f62a9e5..e54d2c770c 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestFileProvider.cs +++ b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestFileProvider.cs @@ -4,11 +4,9 @@ using System; using System.Collections.Generic; using System.IO; -using Microsoft.AspNetCore.Mvc.TestCommon; -using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.Mvc.Razor +namespace Microsoft.Extensions.FileProviders { public class TestFileProvider : IFileProvider { diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestRazorCompiledItem.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorCompiledItem.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestRazorCompiledItem.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorCompiledItem.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestRazorProjectItem.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorProjectItem.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestRazorProjectItem.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorProjectItem.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestViewBufferScope.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestViewBufferScope.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/TestViewBufferScope.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestViewBufferScope.cs diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/VirtualRazorProjectFileSystem.cs b/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/VirtualRazorProjectFileSystem.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.TestCommon/VirtualRazorProjectFileSystem.cs rename to test/Microsoft.AspNetCore.Mvc.Views.TestCommon/VirtualRazorProjectFileSystem.cs diff --git a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj index b10e11d8e7..888ee8f077 100644 --- a/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj +++ b/test/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest/Microsoft.AspNetCore.Mvc.WebApiCompatShimTest.csproj @@ -7,7 +7,7 @@ - +