();
generator
diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs
index e81640fd14..fa83cf6cfe 100644
--- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs
+++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs
@@ -3,8 +3,8 @@
using System.Collections.Generic;
using System.IO;
+using Microsoft.AspNet.Html.Abstractions;
using Microsoft.AspNet.Mvc.Rendering;
-using Microsoft.AspNet.Mvc.TestCommon;
using Microsoft.Framework.WebEncoders.Testing;
using Xunit;
@@ -92,21 +92,6 @@ namespace Microsoft.AspNet.Mvc.Core.Rendering
}
}
- [Fact]
- public void SetInnerText_HtmlEncodesValue()
- {
- // Arrange
- var tagBuilder = new TagBuilder("p");
-
- // Act
- tagBuilder.SetInnerText("TestValue");
-
- // Assert
- Assert.Equal(
- "HtmlEncode[[TestValue]]",
- HtmlContentUtilities.HtmlContentToString(tagBuilder.InnerHtml));
- }
-
[Theory]
[InlineData("HelloWorld", "HelloWorld")]
[InlineData("ĦHelloWorld", "zHelloWorld")]
@@ -119,5 +104,23 @@ namespace Microsoft.AspNet.Mvc.Core.Rendering
// Assert
Assert.Equal(output, result);
}
+
+ [Fact]
+ public void WriteTo_IncludesInnerHtml()
+ {
+ // Arrange
+ var tagBuilder = new TagBuilder("p");
+ tagBuilder.InnerHtml.AppendEncoded("Hello");
+ tagBuilder.InnerHtml.Append(", World!");
+
+ // Act
+ using (var writer = new StringWriter())
+ {
+ tagBuilder.WriteTo(writer, new CommonTestEncoder());
+
+ // Assert
+ Assert.Equal("HelloHtmlEncode[[, World!]]
", writer.ToString());
+ }
+ }
}
}
\ No newline at end of file
diff --git a/test/WebSites/ActivatorWebSite/TagHelpers/TitleTagHelper.cs b/test/WebSites/ActivatorWebSite/TagHelpers/TitleTagHelper.cs
index 08361f0373..4ba4c8fdf5 100644
--- a/test/WebSites/ActivatorWebSite/TagHelpers/TitleTagHelper.cs
+++ b/test/WebSites/ActivatorWebSite/TagHelpers/TitleTagHelper.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using Microsoft.AspNet.Html.Abstractions;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
@@ -26,8 +27,8 @@ namespace ActivatorWebSite.TagHelpers
(HtmlHelper as ICanHasViewContext)?.Contextualize(ViewContext);
var builder = new TagBuilder("h2");
- var title = ViewContext.ViewBag.Title;
- builder.SetInnerText(title);
+ var title = (string)ViewContext.ViewBag.Title;
+ builder.InnerHtml.SetContent(title);
output.PreContent.SetContent(builder);
}
}