String content emoji (#11386)

Test fix of high-ascii encoding.
This commit is contained in:
Ryan Brandenburg 2019-07-01 15:00:32 -07:00 committed by GitHub
parent 7d7a3c9c81
commit 8a81e3a25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.Text.Encodings.Web;
using Microsoft.Extensions.WebEncoders.Testing;
using Xunit;
@ -22,5 +23,19 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
Assert.Equal("HtmlEncode[[Hello World]]", writer.ToString());
}
}
[Fact]
public void Emoji_EncodedCorrectly()
{
// Arrange & Act
var tearsOfJoy = new StringHtmlContent("😂2");
// Assert
using (var stringWriter = new StringWriter())
{
tearsOfJoy.WriteTo(stringWriter, HtmlEncoder.Default);
Assert.Equal("😂2", stringWriter.ToString(), ignoreCase: true);
}
}
}
}