diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Core/Properties/AssemblyInfo.cs index f97bba2f7f..4adf6b6cd7 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Properties/AssemblyInfo.cs @@ -7,7 +7,6 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Core.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.TagHelpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: NeutralResourcesLanguage("en-us")] diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Properties/AssemblyInfo.cs index e2811d2627..cb2cfb0eeb 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Properties/AssemblyInfo.cs @@ -7,7 +7,6 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.ViewFeatures.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.TagHelpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Formatters.Xml.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] [assembly: AssemblyMetadata("Serviceable", "True")] diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CacheTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CacheTagHelperTest.cs index 9f1ba25f35..db85bc3d23 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CacheTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CacheTagHelperTest.cs @@ -652,7 +652,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers var actionContext = new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor()); return new ViewContext(actionContext, Mock.Of(), - new ViewDataDictionary(new EmptyModelMetadataProvider()), + new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary()), Mock.Of(), TextWriter.Null, new HtmlHelperOptions()); @@ -683,5 +683,5 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers return Task.FromResult(tagHelperContent); }); } - } + } } diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CacheTagKeyTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CacheTagKeyTest.cs index a4285725c2..debed3c36f 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CacheTagKeyTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CacheTagKeyTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Security.Claims; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; @@ -370,13 +369,13 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers // Assert Assert.Equal(expected, key); } - + private static ViewContext GetViewContext() { var actionContext = new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor()); return new ViewContext(actionContext, Mock.Of(), - new ViewDataDictionary(new EmptyModelMetadataProvider()), + new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary()), Mock.Of(), TextWriter.Null, new HtmlHelperOptions()); diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CaseSensitiveTagHelperAttributeComparer.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CaseSensitiveTagHelperAttributeComparer.cs deleted file mode 100644 index c5c4a22cfb..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/CaseSensitiveTagHelperAttributeComparer.cs +++ /dev/null @@ -1,64 +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.Collections.Generic; -using System.IO; -using Microsoft.AspNetCore.Html; -using Microsoft.AspNetCore.Razor.TagHelpers; - -namespace Microsoft.AspNetCore.Mvc.TagHelpers -{ - public class CaseSensitiveTagHelperAttributeComparer : IEqualityComparer - { - public readonly static CaseSensitiveTagHelperAttributeComparer Default = - new CaseSensitiveTagHelperAttributeComparer(); - - private CaseSensitiveTagHelperAttributeComparer() - { - } - - public bool Equals(TagHelperAttribute attributeX, TagHelperAttribute attributeY) - { - if (attributeX == attributeY) - { - return true; - } - - // Normal comparer (TagHelperAttribute.Equals()) doesn't care about the Name case, in tests we do. - return attributeX != null && - string.Equals(attributeX.Name, attributeY.Name, StringComparison.Ordinal) && - attributeX.ValueStyle == attributeY.ValueStyle && - (attributeX.ValueStyle == HtmlAttributeValueStyle.Minimized || - string.Equals(GetString(attributeX.Value), GetString(attributeY.Value))); - } - - public int GetHashCode(TagHelperAttribute attribute) - { - // Manually combine hash codes here. We can't reference HashCodeCombiner because we have internals visible - // from Mvc.Core and Mvc.TagHelpers; both of which reference HashCodeCombiner. - var baseHashCode = 0x1505L; - var attributeHashCode = attribute.GetHashCode(); - var combinedHash = ((baseHashCode << 5) + baseHashCode) ^ attributeHashCode; - var nameHashCode = StringComparer.Ordinal.GetHashCode(attribute.Name); - combinedHash = ((combinedHash << 5) + combinedHash) ^ nameHashCode; - - return combinedHash.GetHashCode(); - } - - private string GetString(object value) - { - var htmlContent = value as IHtmlContent; - if (htmlContent != null) - { - using (var writer = new StringWriter()) - { - htmlContent.WriteTo(writer, NullHtmlEncoder.Default); - return writer.ToString(); - } - } - - return value?.ToString() ?? string.Empty; - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/DistributedCacheTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/DistributedCacheTagHelperTest.cs index 57cec0b647..147c0574a1 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/DistributedCacheTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/DistributedCacheTagHelperTest.cs @@ -719,7 +719,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers var actionContext = new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor()); return new ViewContext(actionContext, Mock.Of(), - new ViewDataDictionary(new EmptyModelMetadataProvider()), + new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary()), Mock.Of(), TextWriter.Null, new HtmlHelperOptions()); diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs index 5879eca4c0..9b3405306d 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/FormTagHelperTest.cs @@ -707,7 +707,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers return new ViewContext( actionContext, Mock.Of(), - new ViewDataDictionary(new TestModelMetadataProvider()), + new ViewDataDictionary(new TestModelMetadataProvider(), new ModelStateDictionary()), Mock.Of(), TextWriter.Null, new HtmlHelperOptions()); diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ImageTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ImageTagHelperTest.cs index 0f53b39a1b..040df4b37d 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ImageTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ImageTagHelperTest.cs @@ -268,7 +268,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers } var metadataProvider = new EmptyModelMetadataProvider(); - var viewData = new ViewDataDictionary(metadataProvider); + var viewData = new ViewDataDictionary(metadataProvider, new ModelStateDictionary()); var viewContext = new ViewContext( actionContext, Mock.Of(), diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/InputTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/InputTagHelperTest.cs index e4a4831239..e7718c5214 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/InputTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/InputTagHelperTest.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.AspNetCore.Razor.TagHelpers.Testing; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs index 5f047a3a1b..1260e57083 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/LinkTagHelperTest.cs @@ -984,7 +984,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers } var metadataProvider = new EmptyModelMetadataProvider(); - var viewData = new ViewDataDictionary(metadataProvider); + var viewData = new ViewDataDictionary(metadataProvider, new ModelStateDictionary()); var viewContext = new ViewContext( actionContext, Mock.Of(), diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs index 74b862f24b..4a2e7f6241 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs @@ -922,7 +922,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers } var metadataProvider = new EmptyModelMetadataProvider(); - var viewData = new ViewDataDictionary(metadataProvider); + var viewData = new ViewDataDictionary(metadataProvider, new ModelStateDictionary()); var viewContext = new ViewContext( actionContext, Mock.Of(), diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TagHelperOutputExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TagHelperOutputExtensionsTest.cs index 0011cbcf0c..3e70b3ffc6 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TagHelperOutputExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/TagHelperOutputExtensionsTest.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.AspNetCore.Razor.TagHelpers.Testing; using Microsoft.AspNetCore.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationMessageTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationMessageTagHelperTest.cs index d704154584..be190e769a 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationMessageTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationMessageTagHelperTest.cs @@ -324,7 +324,8 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers actionContext, Mock.Of(), new ViewDataDictionary( - new EmptyModelMetadataProvider()), + new EmptyModelMetadataProvider(), + new ModelStateDictionary()), Mock.Of(), TextWriter.Null, new HtmlHelperOptions()); diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationSummaryTagHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationSummaryTagHelperTest.cs index cb8aa3977d..d4e5b0ede3 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationSummaryTagHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/ValidationSummaryTagHelperTest.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Mvc.TestCommon; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.AspNetCore.Razor.TagHelpers.Testing; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Testing; using Moq; @@ -589,7 +590,8 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers actionContext, Mock.Of(), new ViewDataDictionary( - new EmptyModelMetadataProvider()), + new EmptyModelMetadataProvider(), + new ModelStateDictionary()), Mock.Of(), TextWriter.Null, new HtmlHelperOptions()); diff --git a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/project.json b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/project.json index c19f8eb6f0..35270e6396 100644 --- a/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/project.json +++ b/test/Microsoft.AspNetCore.Mvc.TagHelpers.Test/project.json @@ -13,6 +13,10 @@ "version": "1.1.0-*", "type": "build" }, + "Microsoft.AspNetCore.Razor.TagHelpers.Testing.Sources": { + "version": "1.1.0-*", + "type": "build" + }, "Microsoft.AspNetCore.Testing": "1.1.0-*", "Microsoft.DotNet.InternalAbstractions": "1.0.0", "Microsoft.Extensions.Logging.Abstractions": "1.1.0-*",