/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Mvc/Mvc.ViewFeatures/test/StringHtmlContentTest.cs
38 строк
1 KB
Shreyas Jejurkar
chore : Remove unwanted `using` statement (#39176)
02 янв 2022, 17:39
Не верифицирован
02 янв 2022, 17:39
c85baf8
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Text.Encodings.Web; using Microsoft.Extensions.WebEncoders.Testing; namespace Microsoft.AspNetCore.Mvc.ViewFeatures; public class StringHtmlContentTest { [Fact] public void WriteTo_WritesContent() { // Arrange & Act var content = new StringHtmlContent("Hello World"); // Assert using (var writer = new StringWriter()) { content.WriteTo(writer, new HtmlTestEncoder()); 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); } } }