Remove Microsoft.Framework.WebEncoders.Testing dependency
This commit is contained in:
parent
78a8748248
commit
3cb50b9cf5
|
|
@ -7,7 +7,6 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.AspNet.Testing;
|
using Microsoft.AspNet.Testing;
|
||||||
using Microsoft.Framework.WebEncoders;
|
using Microsoft.Framework.WebEncoders;
|
||||||
using Microsoft.Framework.WebEncoders.Testing;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Html.Abstractions.Test
|
namespace Microsoft.AspNet.Html.Abstractions.Test
|
||||||
|
|
@ -230,7 +229,7 @@ namespace Microsoft.AspNet.Html.Abstractions.Test
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal("0xHtmlEncode[[32]]", HtmlContentToString(builder));
|
Assert.Equal("0xHtmlEncode[[32]]", HtmlContentToString(builder));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Builder_AppendFormat_WithCulture()
|
public void Builder_AppendFormat_WithCulture()
|
||||||
{
|
{
|
||||||
|
|
@ -248,7 +247,7 @@ namespace Microsoft.AspNet.Html.Abstractions.Test
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(
|
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]]!",
|
"HtmlEncode[[145.82]] HtmlEncode[[32.86]]!",
|
||||||
HtmlContentToString(builder));
|
HtmlContentToString(builder));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.Html.Abstractions": "1.0.0-*",
|
"Microsoft.AspNet.Html.Abstractions": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
|
||||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||||
},
|
},
|
||||||
|
"compile": [ "../Microsoft.Framework.WebEncoders.Tests/CommonTestEncoder.cs" ],
|
||||||
"commands": {
|
"commands": {
|
||||||
"test": "xunit.runner.aspnet"
|
"test": "xunit.runner.aspnet"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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.IO;
|
||||||
using Microsoft.AspNet.Html.Abstractions;
|
using Microsoft.AspNet.Html.Abstractions;
|
||||||
using Microsoft.Framework.WebEncoders;
|
using Microsoft.Framework.WebEncoders;
|
||||||
using Microsoft.Framework.WebEncoders.Testing;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.Framework.Internal
|
namespace Microsoft.Framework.Internal
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.Html.Abstractions": "1.0.0-*",
|
"Microsoft.AspNet.Html.Abstractions": "1.0.0-*",
|
||||||
"Microsoft.Framework.BufferedHtmlContent.Sources": { "type": "build", "version": "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-*"
|
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||||
},
|
},
|
||||||
|
"compile": [ "../Microsoft.Framework.WebEncoders.Tests/CommonTestEncoder.cs" ],
|
||||||
"commands": {
|
"commands": {
|
||||||
"test": "xunit.runner.aspnet"
|
"test": "xunit.runner.aspnet"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Encoder used for unit testing.
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class CommonTestEncoder : IHtmlEncoder, IJavaScriptStringEncoder, IUrlEncoder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns "HtmlEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
public string HtmlEncode(string value)
|
||||||
|
{
|
||||||
|
return EncodeCore(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes "HtmlEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
public void HtmlEncode(string value, int startIndex, int charCount, TextWriter output)
|
||||||
|
{
|
||||||
|
EncodeCore(value, startIndex, charCount, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes "HtmlEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
public void HtmlEncode(char[] value, int startIndex, int charCount, TextWriter output)
|
||||||
|
{
|
||||||
|
EncodeCore(value, startIndex, charCount, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns "JavaScriptStringEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
public string JavaScriptStringEncode(string value)
|
||||||
|
{
|
||||||
|
return EncodeCore(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes "JavaScriptStringEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
public void JavaScriptStringEncode(string value, int startIndex, int charCount, TextWriter output)
|
||||||
|
{
|
||||||
|
EncodeCore(value, startIndex, charCount, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes "JavaScriptStringEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
public void JavaScriptStringEncode(char[] value, int startIndex, int charCount, TextWriter output)
|
||||||
|
{
|
||||||
|
EncodeCore(value, startIndex, charCount, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns "UrlEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
public string UrlEncode(string value)
|
||||||
|
{
|
||||||
|
return EncodeCore(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes "UrlEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
public void UrlEncode(string value, int startIndex, int charCount, TextWriter output)
|
||||||
|
{
|
||||||
|
EncodeCore(value, startIndex, charCount, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes "UrlEncode[[value]]".
|
||||||
|
/// </summary>
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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.DependencyInjection;
|
||||||
using Microsoft.Framework.WebEncoders.Testing;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.Framework.WebEncoders
|
namespace Microsoft.Framework.WebEncoders
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
|
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
|
||||||
"Microsoft.Framework.WebEncoders": "1.0.0-*",
|
"Microsoft.Framework.WebEncoders": "1.0.0-*",
|
||||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
|
||||||
"Newtonsoft.Json": "6.0.6",
|
"Newtonsoft.Json": "6.0.6",
|
||||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue