diff --git a/test/Microsoft.AspNet.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs b/test/Microsoft.AspNet.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs
index 4493048940..a32724ca8f 100644
--- a/test/Microsoft.AspNet.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs
+++ b/test/Microsoft.AspNet.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs
@@ -7,7 +7,6 @@ using System.Globalization;
using System.IO;
using Microsoft.AspNet.Testing;
using Microsoft.Framework.WebEncoders;
-using Microsoft.Framework.WebEncoders.Testing;
using Xunit;
namespace Microsoft.AspNet.Html.Abstractions.Test
@@ -230,7 +229,7 @@ namespace Microsoft.AspNet.Html.Abstractions.Test
// Assert
Assert.Equal("0xHtmlEncode[[32]]", HtmlContentToString(builder));
}
-
+
[Fact]
public void Builder_AppendFormat_WithCulture()
{
@@ -248,7 +247,7 @@ namespace Microsoft.AspNet.Html.Abstractions.Test
// Assert
Assert.Equal(
- "Numbers in InvariantCulture - HtmlEncode[[1.10]] HtmlEncode[[2.98]] " +
+ "Numbers in InvariantCulture - HtmlEncode[[1.10]] HtmlEncode[[2.98]] " +
"HtmlEncode[[145.82]] HtmlEncode[[32.86]]!",
HtmlContentToString(builder));
}
diff --git a/test/Microsoft.AspNet.Html.Abstractions.Test/project.json b/test/Microsoft.AspNet.Html.Abstractions.Test/project.json
index 9d82a3d934..4536c6b8d2 100644
--- a/test/Microsoft.AspNet.Html.Abstractions.Test/project.json
+++ b/test/Microsoft.AspNet.Html.Abstractions.Test/project.json
@@ -2,9 +2,9 @@
"dependencies": {
"Microsoft.AspNet.Html.Abstractions": "1.0.0-*",
"Microsoft.AspNet.Testing": "1.0.0-*",
- "Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
+ "compile": [ "../Microsoft.Framework.WebEncoders.Tests/CommonTestEncoder.cs" ],
"commands": {
"test": "xunit.runner.aspnet"
},
diff --git a/test/Microsoft.Framework.BufferedHtmlContent.Test/BufferedHtmlContentTest.cs b/test/Microsoft.Framework.BufferedHtmlContent.Test/BufferedHtmlContentTest.cs
index aa0d20b2d3..234da8af9c 100644
--- a/test/Microsoft.Framework.BufferedHtmlContent.Test/BufferedHtmlContentTest.cs
+++ b/test/Microsoft.Framework.BufferedHtmlContent.Test/BufferedHtmlContentTest.cs
@@ -1,11 +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;
using System.IO;
using Microsoft.AspNet.Html.Abstractions;
using Microsoft.Framework.WebEncoders;
-using Microsoft.Framework.WebEncoders.Testing;
using Xunit;
namespace Microsoft.Framework.Internal
diff --git a/test/Microsoft.Framework.BufferedHtmlContent.Test/project.json b/test/Microsoft.Framework.BufferedHtmlContent.Test/project.json
index 0e2b957585..8064ceed44 100644
--- a/test/Microsoft.Framework.BufferedHtmlContent.Test/project.json
+++ b/test/Microsoft.Framework.BufferedHtmlContent.Test/project.json
@@ -5,9 +5,9 @@
"dependencies": {
"Microsoft.AspNet.Html.Abstractions": "1.0.0-*",
"Microsoft.Framework.BufferedHtmlContent.Sources": { "type": "build", "version": "1.0.0-*" },
- "Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
+ "compile": [ "../Microsoft.Framework.WebEncoders.Tests/CommonTestEncoder.cs" ],
"commands": {
"test": "xunit.runner.aspnet"
},
diff --git a/test/Microsoft.Framework.WebEncoders.Tests/CommonTestEncoder.cs b/test/Microsoft.Framework.WebEncoders.Tests/CommonTestEncoder.cs
new file mode 100644
index 0000000000..9f24eae292
--- /dev/null
+++ b/test/Microsoft.Framework.WebEncoders.Tests/CommonTestEncoder.cs
@@ -0,0 +1,103 @@
+// 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.Globalization;
+using System.IO;
+using System.Runtime.CompilerServices;
+
+namespace Microsoft.Framework.WebEncoders
+{
+ ///
+ /// Encoder used for unit testing.
+ ///
+ internal sealed class CommonTestEncoder : IHtmlEncoder, IJavaScriptStringEncoder, IUrlEncoder
+ {
+ ///
+ /// Returns "HtmlEncode[[value]]".
+ ///
+ public string HtmlEncode(string value)
+ {
+ return EncodeCore(value);
+ }
+
+ ///
+ /// Writes "HtmlEncode[[value]]".
+ ///
+ public void HtmlEncode(string value, int startIndex, int charCount, TextWriter output)
+ {
+ EncodeCore(value, startIndex, charCount, output);
+ }
+
+ ///
+ /// Writes "HtmlEncode[[value]]".
+ ///
+ public void HtmlEncode(char[] value, int startIndex, int charCount, TextWriter output)
+ {
+ EncodeCore(value, startIndex, charCount, output);
+ }
+
+ ///
+ /// Returns "JavaScriptStringEncode[[value]]".
+ ///
+ public string JavaScriptStringEncode(string value)
+ {
+ return EncodeCore(value);
+ }
+
+ ///
+ /// Writes "JavaScriptStringEncode[[value]]".
+ ///
+ public void JavaScriptStringEncode(string value, int startIndex, int charCount, TextWriter output)
+ {
+ EncodeCore(value, startIndex, charCount, output);
+ }
+
+ ///
+ /// Writes "JavaScriptStringEncode[[value]]".
+ ///
+ public void JavaScriptStringEncode(char[] value, int startIndex, int charCount, TextWriter output)
+ {
+ EncodeCore(value, startIndex, charCount, output);
+ }
+
+ ///
+ /// Returns "UrlEncode[[value]]".
+ ///
+ public string UrlEncode(string value)
+ {
+ return EncodeCore(value);
+ }
+
+ ///
+ /// Writes "UrlEncode[[value]]".
+ ///
+ public void UrlEncode(string value, int startIndex, int charCount, TextWriter output)
+ {
+ EncodeCore(value, startIndex, charCount, output);
+ }
+
+ ///
+ /// Writes "UrlEncode[[value]]".
+ ///
+ public void UrlEncode(char[] value, int startIndex, int charCount, TextWriter output)
+ {
+ EncodeCore(value, startIndex, charCount, output);
+ }
+
+ private static string EncodeCore(string value, [CallerMemberName] string encodeType = null)
+ {
+ return String.Format(CultureInfo.InvariantCulture, "{0}[[{1}]]", encodeType, value);
+ }
+
+ private static void EncodeCore(string value, int startIndex, int charCount, TextWriter output, [CallerMemberName] string encodeType = null)
+ {
+ output.Write(EncodeCore(value.Substring(startIndex, charCount), encodeType));
+ }
+
+ private static void EncodeCore(char[] value, int startIndex, int charCount, TextWriter output, [CallerMemberName] string encodeType = null)
+ {
+ output.Write(EncodeCore(new string(value, startIndex, charCount), encodeType));
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Microsoft.Framework.WebEncoders.Tests/EncoderServiceCollectionExtensionsTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/EncoderServiceCollectionExtensionsTests.cs
index f45951277e..ff6acd3772 100644
--- a/test/Microsoft.Framework.WebEncoders.Tests/EncoderServiceCollectionExtensionsTests.cs
+++ b/test/Microsoft.Framework.WebEncoders.Tests/EncoderServiceCollectionExtensionsTests.cs
@@ -1,10 +1,8 @@
// 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 Xunit;
using Microsoft.Framework.DependencyInjection;
-using Microsoft.Framework.WebEncoders.Testing;
+using Xunit;
namespace Microsoft.Framework.WebEncoders
{
diff --git a/test/Microsoft.Framework.WebEncoders.Tests/project.json b/test/Microsoft.Framework.WebEncoders.Tests/project.json
index 0968582e6b..c5c1f52c94 100644
--- a/test/Microsoft.Framework.WebEncoders.Tests/project.json
+++ b/test/Microsoft.Framework.WebEncoders.Tests/project.json
@@ -2,7 +2,6 @@
"dependencies": {
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
"Microsoft.Framework.WebEncoders": "1.0.0-*",
- "Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
"Newtonsoft.Json": "6.0.6",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},