Update tests for Razor Tag Helpers Unique ID feature:

- aspnet/razor#241
This commit is contained in:
DamianEdwards 2014-12-12 16:15:20 -08:00
parent 3e26142de1
commit 263e75c8a6
12 changed files with 109 additions and 37 deletions

View File

@ -3,8 +3,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Microsoft.AspNet.FileSystems;
using Microsoft.AspNet.Razor; using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Xunit; using Xunit;
@ -66,7 +69,7 @@ namespace Microsoft.AspNet.Mvc.Razor
public void MvcRazorHost_ParsesAndGeneratesCodeForBasicScenarios(string scenarioName) public void MvcRazorHost_ParsesAndGeneratesCodeForBasicScenarios(string scenarioName)
{ {
// Arrange // Arrange
var host = new MvcRazorHost(new TestFileSystem()); var host = new TestMvcRazorHost(new TestFileSystem());
// Act and Assert // Act and Assert
RunRuntimeTest(host, scenarioName); RunRuntimeTest(host, scenarioName);
@ -205,5 +208,68 @@ namespace Microsoft.AspNet.Mvc.Razor
documentLocation: new MappingLocation(documentLocation, contentLength), documentLocation: new MappingLocation(documentLocation, contentLength),
generatedLocation: new MappingLocation(generatedLocation, contentLength)); generatedLocation: new MappingLocation(generatedLocation, contentLength));
} }
/// <summary>
/// Used when testing Tag Helpers, it disables the unique ID generation feature.
/// </summary>
private class TestMvcRazorHost : MvcRazorHost
{
public TestMvcRazorHost(IFileSystem fileSystem)
: base(fileSystem)
{ }
public override CodeBuilder DecorateCodeBuilder(CodeBuilder incomingBuilder, CodeBuilderContext context)
{
base.DecorateCodeBuilder(incomingBuilder, context);
return new TestCSharpCodeBuilder(context,
DefaultModel,
ActivateAttribute,
new GeneratedTagHelperAttributeContext
{
ModelExpressionTypeName = ModelExpressionType,
CreateModelExpressionMethodName = CreateModelExpressionMethod
});
}
protected class TestCSharpCodeBuilder : MvcCSharpCodeBuilder
{
private readonly GeneratedTagHelperAttributeContext _tagHelperAttributeContext;
public TestCSharpCodeBuilder(CodeBuilderContext context,
string defaultModel,
string activateAttribute,
GeneratedTagHelperAttributeContext tagHelperAttributeContext)
: base(context, defaultModel, activateAttribute, tagHelperAttributeContext)
{
_tagHelperAttributeContext = tagHelperAttributeContext;
}
protected override CSharpCodeVisitor CreateCSharpCodeVisitor(CSharpCodeWriter writer, CodeBuilderContext context)
{
var visitor = base.CreateCSharpCodeVisitor(writer, context);
visitor.TagHelperRenderer = new NoUniqueIdsTagHelperCodeRenderer(visitor, writer, context)
{
AttributeValueCodeRenderer =
new MvcTagHelperAttributeValueCodeRenderer(_tagHelperAttributeContext)
};
return visitor;
}
private class NoUniqueIdsTagHelperCodeRenderer : CSharpTagHelperCodeRenderer
{
public NoUniqueIdsTagHelperCodeRenderer(IChunkVisitor bodyVisitor,
CSharpCodeWriter writer,
CodeBuilderContext context)
: base(bodyVisitor, writer, context)
{ }
protected override string GenerateUniqueId()
{
return "test";
}
}
}
}
} }
} }

View File

@ -43,7 +43,7 @@ namespace Asp
BeginContext(120, 2, true); BeginContext(120, 2, true);
WriteLiteral("\r\n"); WriteLiteral("\r\n");
EndContext(); EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("inputTest"); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("inputTest", "test");
__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper<Microsoft.AspNet.Mvc.Razor.InputTestTagHelper>(); __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper<Microsoft.AspNet.Mvc.Razor.InputTestTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper); __tagHelperExecutionContext.Add(__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper);
__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => __model.Now); __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => __model.Now);

View File

@ -31,7 +31,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ "asp-fragment", "hello=world" }, { "asp-fragment", "hello=world" },
{ "asp-host", "contoso.com" }, { "asp-host", "contoso.com" },
{ "asp-protocol", "http" } { "asp-protocol", "http" }
}); },
uniqueId: "test");
var output = new TagHelperOutput( var output = new TagHelperOutput(
expectedTagName, expectedTagName,
attributes: new Dictionary<string, string> attributes: new Dictionary<string, string>
@ -84,7 +85,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ {
// Arrange // Arrange
var context = new TagHelperContext( var context = new TagHelperContext(
allAttributes: new Dictionary<string, object>()); allAttributes: new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput( var output = new TagHelperOutput(
"a", "a",
attributes: new Dictionary<string, string>(), attributes: new Dictionary<string, string>(),
@ -118,7 +119,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ {
// Arrange // Arrange
var context = new TagHelperContext( var context = new TagHelperContext(
allAttributes: new Dictionary<string, object>()); allAttributes: new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput( var output = new TagHelperOutput(
"a", "a",
attributes: new Dictionary<string, string>(), attributes: new Dictionary<string, string>(),

View File

@ -32,7 +32,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ "asp-controller", "home" }, { "asp-controller", "home" },
{ "method", "post" }, { "method", "post" },
{ "asp-anti-forgery", true } { "asp-anti-forgery", true }
}); },
uniqueId: "test");
var output = new TagHelperOutput( var output = new TagHelperOutput(
expectedTagName, expectedTagName,
attributes: new Dictionary<string, string> attributes: new Dictionary<string, string>
@ -91,7 +92,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
// Arrange // Arrange
var viewContext = CreateViewContext(); var viewContext = CreateViewContext();
var context = new TagHelperContext( var context = new TagHelperContext(
allAttributes: new Dictionary<string, object>()); allAttributes: new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput( var output = new TagHelperOutput(
"form", "form",
attributes: new Dictionary<string, string>(), attributes: new Dictionary<string, string>(),
@ -132,7 +133,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
// Arrange // Arrange
var testViewContext = CreateViewContext(); var testViewContext = CreateViewContext();
var context = new TagHelperContext( var context = new TagHelperContext(
allAttributes: new Dictionary<string, object>()); allAttributes: new Dictionary<string, object>(), uniqueId: "test");
var expectedAttribute = new KeyValuePair<string, string>("asp-ROUTEE-NotRoute", "something"); var expectedAttribute = new KeyValuePair<string, string>("asp-ROUTEE-NotRoute", "something");
var output = new TagHelperOutput( var output = new TagHelperOutput(
"form", "form",
@ -193,7 +194,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
// Arrange // Arrange
var viewContext = CreateViewContext(); var viewContext = CreateViewContext();
var context = new TagHelperContext( var context = new TagHelperContext(
allAttributes: new Dictionary<string, object>()); allAttributes: new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput( var output = new TagHelperOutput(
"form", "form",
attributes: new Dictionary<string, string>(), attributes: new Dictionary<string, string>(),
@ -243,7 +244,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
allAttributes: new Dictionary<string, object>() allAttributes: new Dictionary<string, object>()
{ {
{ "METhod", "POST" } { "METhod", "POST" }
}); },
uniqueId: "test");
// Act // Act
await formTagHelper.ProcessAsync(context, output); await formTagHelper.ProcessAsync(context, output);
@ -284,7 +286,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ "aCTiON", "my-action" }, { "aCTiON", "my-action" },
}, },
content: string.Empty); content: string.Empty);
var context = new TagHelperContext(allAttributes: new Dictionary<string, object>()); var context = new TagHelperContext(allAttributes: new Dictionary<string, object>(), uniqueId: "test");
// Act // Act
await formTagHelper.ProcessAsync(context, output); await formTagHelper.ProcessAsync(context, output);

View File

@ -92,7 +92,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedContent = "original content"; var expectedContent = "original content";
var expectedTagName = "not-input"; var expectedTagName = "not-input";
var context = new TagHelperContext(new Dictionary<string, object>()); var context = new TagHelperContext(new Dictionary<string, object>(), uniqueId: "test");
var originalAttributes = new Dictionary<string, string> var originalAttributes = new Dictionary<string, string>
{ {
{ "class", "form-control" }, { "class", "form-control" },
@ -137,7 +137,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var originalTagName = "not-input"; var originalTagName = "not-input";
var expectedContent = originalContent + "<input class=\"form-control\" /><hidden />"; var expectedContent = originalContent + "<input class=\"form-control\" /><hidden />";
var context = new TagHelperContext(allAttributes: new Dictionary<string, object>()); var context = new TagHelperContext(allAttributes: new Dictionary<string, object>(), uniqueId: "test");
var originalAttributes = new Dictionary<string, string> var originalAttributes = new Dictionary<string, string>
{ {
{ "class", "form-control" }, { "class", "form-control" },
@ -217,7 +217,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedContent = "something"; var expectedContent = "something";
var expectedTagName = "not-input"; var expectedTagName = "not-input";
var context = new TagHelperContext(allAttributes: contextAttributes); var context = new TagHelperContext(allAttributes: contextAttributes, uniqueId: "test");
var originalAttributes = new Dictionary<string, string> var originalAttributes = new Dictionary<string, string>
{ {
{ "class", "form-control" }, { "class", "form-control" },
@ -294,7 +294,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedContent = "something"; var expectedContent = "something";
var expectedTagName = "not-input"; var expectedTagName = "not-input";
var context = new TagHelperContext(allAttributes: contextAttributes); var context = new TagHelperContext(allAttributes: contextAttributes, uniqueId: "test");
var originalAttributes = new Dictionary<string, string> var originalAttributes = new Dictionary<string, string>
{ {
{ "class", "form-control" }, { "class", "form-control" },
@ -368,7 +368,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedContent = "something"; var expectedContent = "something";
var expectedTagName = "not-input"; var expectedTagName = "not-input";
var context = new TagHelperContext(allAttributes: contextAttributes); var context = new TagHelperContext(allAttributes: contextAttributes, uniqueId: "test");
var originalAttributes = new Dictionary<string, string> var originalAttributes = new Dictionary<string, string>
{ {
{ "class", "form-control" }, { "class", "form-control" },
@ -457,7 +457,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedContent = "something"; var expectedContent = "something";
var expectedTagName = "not-input"; var expectedTagName = "not-input";
var context = new TagHelperContext(allAttributes: contextAttributes); var context = new TagHelperContext(allAttributes: contextAttributes, uniqueId: "test");
var originalAttributes = new Dictionary<string, string> var originalAttributes = new Dictionary<string, string>
{ {
{ "class", "form-control" }, { "class", "form-control" },
@ -515,7 +515,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedContent = "original content"; var expectedContent = "original content";
var expectedTagName = "input"; var expectedTagName = "input";
var tagHelperContext = new TagHelperContext(new Dictionary<string, object>()); var tagHelperContext = new TagHelperContext(new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, expectedAttributes, expectedContent) var output = new TagHelperOutput(expectedTagName, expectedAttributes, expectedContent)
{ {
SelfClosing = false, SelfClosing = false,
@ -563,7 +563,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedMessage = "Unable to format without a 'asp-for' expression for <input>. 'asp-format' must " + var expectedMessage = "Unable to format without a 'asp-for' expression for <input>. 'asp-format' must " +
"be null if 'asp-for' is null."; "be null if 'asp-for' is null.";
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, originalAttributes, content); var output = new TagHelperOutput(expectedTagName, originalAttributes, content);
var tagHelper = new InputTagHelper var tagHelper = new InputTagHelper
{ {

View File

@ -113,7 +113,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
For = modelExpression, For = modelExpression,
}; };
var tagHelperContext = new TagHelperContext(allAttributes: new Dictionary<string, object>()); var tagHelperContext = new TagHelperContext(allAttributes: new Dictionary<string, object>(), uniqueId: "test");
var htmlAttributes = new Dictionary<string, string> var htmlAttributes = new Dictionary<string, string>
{ {
{ "class", "form-control" }, { "class", "form-control" },
@ -153,7 +153,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var modelExpression = new ModelExpression(nameof(Model.Text), metadata); var modelExpression = new ModelExpression(nameof(Model.Text), metadata);
var tagHelper = new LabelTagHelper(); var tagHelper = new LabelTagHelper();
var tagHelperContext = new TagHelperContext(allAttributes: new Dictionary<string, object>()); var tagHelperContext = new TagHelperContext(allAttributes: new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, expectedAttributes, expectedContent); var output = new TagHelperOutput(expectedTagName, expectedAttributes, expectedContent);
var htmlGenerator = new TestableHtmlGenerator(metadataProvider); var htmlGenerator = new TestableHtmlGenerator(metadataProvider);

View File

@ -136,7 +136,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ "selected", selected }, { "selected", selected },
{ "value", value }, { "value", value },
}; };
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, originalAttributes, originalContent) var output = new TagHelperOutput(expectedTagName, originalAttributes, originalContent)
{ {
SelfClosing = false, SelfClosing = false,
@ -188,7 +188,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ "selected", selected }, { "selected", selected },
{ "value", value }, { "value", value },
}; };
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(originalTagName, originalAttributes, originalContent) var output = new TagHelperOutput(originalTagName, originalAttributes, originalContent)
{ {
SelfClosing = false, SelfClosing = false,
@ -235,7 +235,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ "selected", selected }, { "selected", selected },
{ "value", value }, { "value", value },
}; };
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(originalTagName, originalAttributes, originalContent) var output = new TagHelperOutput(originalTagName, originalAttributes, originalContent)
{ {
SelfClosing = false, SelfClosing = false,

View File

@ -182,7 +182,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var metadata = metadataProvider.GetMetadataForProperty(modelAccessor, containerType, propertyName: "Text"); var metadata = metadataProvider.GetMetadataForProperty(modelAccessor, containerType, propertyName: "Text");
var modelExpression = new ModelExpression(nameAndId.Name, metadata); var modelExpression = new ModelExpression(nameAndId.Name, metadata);
var tagHelperContext = new TagHelperContext(new Dictionary<string, object>()); var tagHelperContext = new TagHelperContext(new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, originalAttributes, expectedContent) var output = new TagHelperOutput(expectedTagName, originalAttributes, expectedContent)
{ {
SelfClosing = true, SelfClosing = true,
@ -252,7 +252,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var metadata = metadataProvider.GetMetadataForProperty(modelAccessor, containerType, propertyName: "Text"); var metadata = metadataProvider.GetMetadataForProperty(modelAccessor, containerType, propertyName: "Text");
var modelExpression = new ModelExpression(nameAndId.Name, metadata); var modelExpression = new ModelExpression(nameAndId.Name, metadata);
var tagHelperContext = new TagHelperContext(new Dictionary<string, object>()); var tagHelperContext = new TagHelperContext(new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, originalAttributes, originalContent) var output = new TagHelperOutput(expectedTagName, originalAttributes, originalContent)
{ {
SelfClosing = true, SelfClosing = true,
@ -312,7 +312,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var propertyName = "Property1"; var propertyName = "Property1";
var expectedTagName = "select"; var expectedTagName = "select";
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, originalAttributes, content); var output = new TagHelperOutput(expectedTagName, originalAttributes, content);
// TODO: https://github.com/aspnet/Mvc/issues/1253 // TODO: https://github.com/aspnet/Mvc/issues/1253
@ -376,7 +376,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var propertyName = "Property1"; var propertyName = "Property1";
var tagName = "select"; var tagName = "select";
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(tagName, originalAttributes, content); var output = new TagHelperOutput(tagName, originalAttributes, content);
var metadataProvider = new EmptyModelMetadataProvider(); var metadataProvider = new EmptyModelMetadataProvider();
@ -440,7 +440,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedContent = "original content"; var expectedContent = "original content";
var expectedTagName = "select"; var expectedTagName = "select";
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, originalAttributes, expectedContent) var output = new TagHelperOutput(expectedTagName, originalAttributes, expectedContent)
{ {
SelfClosing = true, SelfClosing = true,
@ -471,7 +471,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedTagName = "select"; var expectedTagName = "select";
var expectedMessage = "Cannot determine body for <select>. 'asp-items' must be null if 'asp-for' is null."; var expectedMessage = "Cannot determine body for <select>. 'asp-items' must be null if 'asp-for' is null.";
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, originalAttributes, content); var output = new TagHelperOutput(expectedTagName, originalAttributes, content);
var tagHelper = new SelectTagHelper var tagHelper = new SelectTagHelper
{ {
@ -502,7 +502,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var expectedMessage = "Cannot parse 'multiple' value '" + multiple + var expectedMessage = "Cannot parse 'multiple' value '" + multiple +
"' for <select>. Acceptable values are 'false', 'true' and 'multiple'."; "' for <select>. Acceptable values are 'false', 'true' and 'multiple'.";
var tagHelperContext = new TagHelperContext(contextAttributes); var tagHelperContext = new TagHelperContext(contextAttributes, uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, originalAttributes, content); var output = new TagHelperOutput(expectedTagName, originalAttributes, content);
var metadataProvider = new EmptyModelMetadataProvider(); var metadataProvider = new EmptyModelMetadataProvider();

View File

@ -25,7 +25,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
new Dictionary<string, object>(StringComparer.Ordinal) new Dictionary<string, object>(StringComparer.Ordinal)
{ {
{ attributeName, attributeValue } { attributeName, attributeValue }
}); },
uniqueId: "test");
var expectedAttribute = new KeyValuePair<string, string>(attributeName, attributeValue); var expectedAttribute = new KeyValuePair<string, string>(attributeName, attributeValue);
// Act // Act
@ -53,7 +54,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
new Dictionary<string, object>(StringComparer.Ordinal) new Dictionary<string, object>(StringComparer.Ordinal)
{ {
{ attributeName, "world" } { attributeName, "world" }
}); }
, uniqueId: "test");
// Act // Act
tagHelperOutput.CopyHtmlAttribute(attributeName, tagHelperContext); tagHelperOutput.CopyHtmlAttribute(attributeName, tagHelperContext);

View File

@ -107,7 +107,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
For = modelExpression, For = modelExpression,
}; };
var tagHelperContext = new TagHelperContext(new Dictionary<string, object>()); var tagHelperContext = new TagHelperContext(new Dictionary<string, object>(), uniqueId: "test");
var htmlAttributes = new Dictionary<string, string> var htmlAttributes = new Dictionary<string, string>
{ {
{ "class", "form-control" }, { "class", "form-control" },
@ -157,7 +157,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
var modelExpression = new ModelExpression(nameof(Model.Text), metadata); var modelExpression = new ModelExpression(nameof(Model.Text), metadata);
var tagHelper = new TextAreaTagHelper(); var tagHelper = new TextAreaTagHelper();
var tagHelperContext = new TagHelperContext(new Dictionary<string, object>()); var tagHelperContext = new TagHelperContext(new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput(expectedTagName, expectedAttributes, expectedContent) var output = new TagHelperOutput(expectedTagName, expectedAttributes, expectedContent)
{ {
SelfClosing = true, SelfClosing = true,

View File

@ -33,7 +33,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{ {
{ "id", "myvalidationmessage" }, { "id", "myvalidationmessage" },
{ "for", modelExpression }, { "for", modelExpression },
}); },
uniqueId: "test");
var output = new TagHelperOutput( var output = new TagHelperOutput(
expectedTagName, expectedTagName,
attributes: new Dictionary<string, string> attributes: new Dictionary<string, string>

View File

@ -28,7 +28,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
ValidationSummaryValue = "All" ValidationSummaryValue = "All"
}; };
var tagHelperContext = new TagHelperContext(new Dictionary<string, object>()); var tagHelperContext = new TagHelperContext(new Dictionary<string, object>(), uniqueId: "test");
var output = new TagHelperOutput( var output = new TagHelperOutput(
expectedTagName, expectedTagName,
attributes: new Dictionary<string, string> attributes: new Dictionary<string, string>