From 6468b0142c6c5a25c4b3b2c9d3a0ed5f9ad7a6dd Mon Sep 17 00:00:00 2001 From: Ryan Lamansky <13633345+RyanLamansky@users.noreply.github.com> Date: Sat, 24 Aug 2024 08:22:50 -0500 Subject: [PATCH] Updated test dependencies. --- HtmlUtilities.Tests/CodePointTests.cs | 2 +- .../HtmlUtilities.Tests.csproj | 6 ++-- HtmlUtilities.Tests/HtmlWriterAsyncTests.cs | 36 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/HtmlUtilities.Tests/CodePointTests.cs b/HtmlUtilities.Tests/CodePointTests.cs index 8d0b57d..9185e90 100644 --- a/HtmlUtilities.Tests/CodePointTests.cs +++ b/HtmlUtilities.Tests/CodePointTests.cs @@ -92,7 +92,7 @@ public static void DecodeUtf16FromEnumerableCharacters(string? value, CodePoint[ [MemberData(nameof(Utf16TestCasesWithInvalidCodePoints))] public static void EncodeUtf16FromEnumerableCodePoints(string? expected, CodePoint[] value) { - Assert.Equal(expected is null ? "" : expected, CodePoint.EncodeUtf16(value).ToArray()); + Assert.Equal(expected is null ? "" : expected, new string(CodePoint.EncodeUtf16(value).ToArray())); } [Theory] diff --git a/HtmlUtilities.Tests/HtmlUtilities.Tests.csproj b/HtmlUtilities.Tests/HtmlUtilities.Tests.csproj index dfa3a98..30d1f21 100644 --- a/HtmlUtilities.Tests/HtmlUtilities.Tests.csproj +++ b/HtmlUtilities.Tests/HtmlUtilities.Tests.csproj @@ -13,9 +13,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/HtmlUtilities.Tests/HtmlWriterAsyncTests.cs b/HtmlUtilities.Tests/HtmlWriterAsyncTests.cs index a78dcdd..f69395f 100644 --- a/HtmlUtilities.Tests/HtmlWriterAsyncTests.cs +++ b/HtmlUtilities.Tests/HtmlWriterAsyncTests.cs @@ -11,7 +11,7 @@ public static class HtmlWriterAsyncTests public static async Task EmptyDocument() { var buffer = new ArrayBufferWriter(); - await HtmlWriter.WriteDocumentAsync(buffer).ConfigureAwait(false); + await HtmlWriter.WriteDocumentAsync(buffer); Assert.Equal("", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -20,7 +20,7 @@ public static async Task EmptyDocument() public static async Task WriteChildElement() { var buffer = new ArrayBufferWriter(); - await HtmlWriter.WriteDocumentAsync(buffer, children: (writer, cancellationToken) => writer.WriteElementAsync(new ValidatedElement("head"), cancellationToken: cancellationToken)).ConfigureAwait(false); + await HtmlWriter.WriteDocumentAsync(buffer, children: (writer, cancellationToken) => writer.WriteElementAsync(new ValidatedElement("head"), cancellationToken: cancellationToken)); Assert.Equal("", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -33,7 +33,7 @@ public static async Task WriteUnconstructedChildElementThrows() var caught = await Assert .ThrowsAsync(() => HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteElementAsync(array[0], cancellationToken: cancellationToken))) - .ConfigureAwait(false); + ; Assert.Equal("element", caught.ParamName); } @@ -42,7 +42,7 @@ public static async Task WriteUnconstructedChildElementThrows() public static async Task WriteAttribute() { var buffer = new ArrayBufferWriter(); - await HtmlWriter.WriteDocumentAsync(buffer, attributes => attributes.Write("lang", "en-us")).ConfigureAwait(false); + await HtmlWriter.WriteDocumentAsync(buffer, attributes => attributes.Write("lang", "en-us")); Assert.Equal("", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -51,7 +51,7 @@ public static async Task WriteAttribute() public static async Task WriteAttributeAndChildElement() { var buffer = new ArrayBufferWriter(); - await HtmlWriter.WriteDocumentAsync(buffer, attributes => attributes.Write("lang", "en-us"), (writer, cancellationToken) => writer.WriteElementAsync(new ValidatedElement("head"), cancellationToken: cancellationToken)).ConfigureAwait(false); + await HtmlWriter.WriteDocumentAsync(buffer, attributes => attributes.Write("lang", "en-us"), (writer, cancellationToken) => writer.WriteElementAsync(new ValidatedElement("head"), cancellationToken: cancellationToken)); Assert.Equal("", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -67,7 +67,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteText("Test"); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("Test", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -83,7 +83,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteText("Test"); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("Test", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -99,7 +99,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteText("Test"); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("Test", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -115,7 +115,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteElementSelfClosing(new ValidatedElement("meta"), attributes => attributes.Write("charset", "utf-8")); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -131,7 +131,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteElementSelfClosing("meta", attributes => attributes.Write("charset", "utf-8")); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -147,7 +147,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteElementSelfClosing("meta".AsSpan(), attributes => attributes.Write("charset", "utf-8")); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -163,7 +163,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteElementSelfClosing(new ValidatedElement("p")); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("

", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -179,7 +179,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteElementSelfClosing("p"); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("

", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -195,7 +195,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteElementSelfClosing("p".AsSpan()); return Task.CompletedTask; }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("

", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -210,7 +210,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => { return writer.WriteElementAsync(new ValidatedElement("div", [("id", "react-app")]), attributes => attributes.Write("class", "root"), cancellationToken: cancellationToken); }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("

", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -229,7 +229,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => return Task.CompletedTask; }, cancellationToken); }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("Test", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -248,7 +248,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => return Task.CompletedTask; }, cancellationToken); }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("Test", Encoding.UTF8.GetString(buffer.WrittenSpan)); } @@ -267,7 +267,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => return Task.CompletedTask; }, cancellationToken); }, cancellationToken: cancellationToken); - }).ConfigureAwait(false); + }); Assert.Equal("Test", Encoding.UTF8.GetString(buffer.WrittenSpan)); }