Skip to content

Commit 7666f97

Browse files
committed
Minor modernization of tests
1 parent cfab527 commit 7666f97

6 files changed

Lines changed: 15 additions & 19 deletions

File tree

src/Tests/CssParserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Devlooped.Tests;
44

5-
public record CssParserTests(ITestOutputHelper Console)
5+
public class CssParserTests(ITestOutputHelper output)
66
{
77
[Fact]
88
public void CanParseUniversalSelector()

src/Tests/HtmlTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
using System.Xml;
2-
using System.Xml.Linq;
32
using System.Xml.XPath;
4-
using Devlooped.Web;
53

64
namespace Devlooped.Tests;
75

8-
public record HtmlTests(ITestOutputHelper Output)
6+
public partial class HtmlTests(ITestOutputHelper output)
97
{
108
[Fact]
119
public void Render()
1210
{
1311
var doc = HtmlDocument.Load(File("sample.html"));
1412

15-
Output.WriteLine(doc.ToString());
13+
output.WriteLine(doc.ToString());
1614
}
1715

1816
[Fact]

src/Tests/Tests.csproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<AssemblyName>Devlooped.Tests</AssemblyName>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
10+
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.4.0" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
1112
<PackageReference Include="xunit" Version="2.9.3" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
13-
<PrivateAssets>all</PrivateAssets>
14-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
15-
</PackageReference>
13+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
1614
<PackageReference Include="Microsoft.Xml.SgmlReader" Version="1.8.30" />
1715
</ItemGroup>
1816

src/Tests/XPathTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Devlooped.Tests;
77

8-
public record XPathTests(ITestOutputHelper Console)
8+
public class XPathTests(ITestOutputHelper output)
99
{
1010
[InlineData("foo", ".//foo")]
1111
[InlineData(".foo", ".//*[contains(concat(\" \",normalize-space(@class),\" \"),\" foo \")]")]
@@ -20,7 +20,7 @@ public void ToXPath(string css, string xpath)
2020
{
2121
var result = Parser.Parse(css).ToXPath();
2222
if (result != xpath)
23-
Console.WriteLine(result);
23+
output.WriteLine(result);
2424

2525
Assert.Equal(xpath, result);
2626
}
@@ -75,7 +75,7 @@ public void EvaluatePageHtml(string expression, string expected)
7575
.Select(x => x.Value));
7676

7777
if (!expected.Equals(actual))
78-
Console.WriteLine($"{expression} > {Parser.Parse(expression).ToXPath()}");
78+
output.WriteLine($"{expression} > {Parser.Parse(expression).ToXPath()}");
7979

8080
Assert.Equal(expected, actual);
8181
}
@@ -126,6 +126,6 @@ internal void AttributeSelectorNormalizesQuotes(string expression, string xpath)
126126
public void RenderExpression()
127127
{
128128
var expression = "*[text()$=\"to go\"]";
129-
Console.WriteLine(Parser.Parse(expression).ToXPath());
129+
output.WriteLine(Parser.Parse(expression).ToXPath());
130130
}
131131
}

src/Tests/XmlTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System.Xml.Linq;
33
using System.Xml.XPath;
44

5-
namespace Tests;
5+
namespace Devlooped.Tests;
66

7-
public record XmlTests(ITestOutputHelper Output)
7+
public class XmlTests(ITestOutputHelper output)
88
{
99
[Fact]
1010
public void RemoveNamespacesFromElement()

src/Web/HtmlReaderSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public sealed class HtmlReaderSettings
1919
{
2020
CaseFolding = CaseFolding.ToLower,
2121
IgnoreXmlNamespaces = true,
22-
SkipElements = new string[] { "script", "style" },
22+
SkipElements = ["script", "style"],
2323
};
2424

2525
/// <summary>

0 commit comments

Comments
 (0)