Skip to content

Commit

Permalink
Updated test dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLamansky committed Aug 24, 2024
1 parent 0536f53 commit 6468b01
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion HtmlUtilities.Tests/CodePointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions HtmlUtilities.Tests/HtmlUtilities.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
36 changes: 18 additions & 18 deletions HtmlUtilities.Tests/HtmlWriterAsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class HtmlWriterAsyncTests
public static async Task EmptyDocument()
{
var buffer = new ArrayBufferWriter<byte>();
await HtmlWriter.WriteDocumentAsync(buffer).ConfigureAwait(false);
await HtmlWriter.WriteDocumentAsync(buffer);

Assert.Equal("<!DOCTYPE html><html></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -20,7 +20,7 @@ public static async Task EmptyDocument()
public static async Task WriteChildElement()
{
var buffer = new ArrayBufferWriter<byte>();
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("<!DOCTYPE html><html><head></head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -33,7 +33,7 @@ public static async Task WriteUnconstructedChildElementThrows()

var caught = await Assert
.ThrowsAsync<ArgumentException>(() => HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) => writer.WriteElementAsync(array[0], cancellationToken: cancellationToken)))
.ConfigureAwait(false);
;

Assert.Equal("element", caught.ParamName);
}
Expand All @@ -42,7 +42,7 @@ public static async Task WriteUnconstructedChildElementThrows()
public static async Task WriteAttribute()
{
var buffer = new ArrayBufferWriter<byte>();
await HtmlWriter.WriteDocumentAsync(buffer, attributes => attributes.Write("lang", "en-us")).ConfigureAwait(false);
await HtmlWriter.WriteDocumentAsync(buffer, attributes => attributes.Write("lang", "en-us"));

Assert.Equal("<!DOCTYPE html><html lang=en-us></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -51,7 +51,7 @@ public static async Task WriteAttribute()
public static async Task WriteAttributeAndChildElement()
{
var buffer = new ArrayBufferWriter<byte>();
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("<!DOCTYPE html><html lang=en-us><head></head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -67,7 +67,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) =>
writer.WriteText("Test");
return Task.CompletedTask;
}, cancellationToken: cancellationToken);
}).ConfigureAwait(false);
});

Assert.Equal("<!DOCTYPE html><html><head>Test</head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -83,7 +83,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) =>
writer.WriteText("Test");
return Task.CompletedTask;
}, cancellationToken: cancellationToken);
}).ConfigureAwait(false);
});

Assert.Equal("<!DOCTYPE html><html><head>Test</head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -99,7 +99,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) =>
writer.WriteText("Test");
return Task.CompletedTask;
}, cancellationToken: cancellationToken);
}).ConfigureAwait(false);
});

Assert.Equal("<!DOCTYPE html><html><head>Test</head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -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("<!DOCTYPE html><html><head><meta charset=utf-8></head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -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("<!DOCTYPE html><html><head><meta charset=utf-8></head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -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("<!DOCTYPE html><html><head><meta charset=utf-8></head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -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("<!DOCTYPE html><html><body><p></body></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -179,7 +179,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) =>
writer.WriteElementSelfClosing("p");
return Task.CompletedTask;
}, cancellationToken: cancellationToken);
}).ConfigureAwait(false);
});

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

Assert.Equal("<!DOCTYPE html><html><body><p></body></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -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("<!DOCTYPE html><html><body><div id=react-app class=root></div></body></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -229,7 +229,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) =>
return Task.CompletedTask;
}, cancellationToken);
}, cancellationToken: cancellationToken);
}).ConfigureAwait(false);
});

Assert.Equal("<!DOCTYPE html><html><head><title>Test</title></head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -248,7 +248,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) =>
return Task.CompletedTask;
}, cancellationToken);
}, cancellationToken: cancellationToken);
}).ConfigureAwait(false);
});

Assert.Equal("<!DOCTYPE html><html><head><title>Test</title></head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand All @@ -267,7 +267,7 @@ await HtmlWriter.WriteDocumentAsync(buffer, null, (writer, cancellationToken) =>
return Task.CompletedTask;
}, cancellationToken);
}, cancellationToken: cancellationToken);
}).ConfigureAwait(false);
});

Assert.Equal("<!DOCTYPE html><html><head><title>Test</title></head></html>", Encoding.UTF8.GetString(buffer.WrittenSpan));
}
Expand Down

0 comments on commit 6468b01

Please sign in to comment.