test(theme): verify bUnit 2.7.2 with patched DOM parser

This commit is contained in:
Joseph Doherty
2026-11-13 14:41:17 -05:00
parent 1118e0418e
commit 9bda64ec4b
23 changed files with 1298 additions and 2 deletions
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<IsTestProject>true</IsTestProject>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="bunit" Version="2.7.2" />
<PackageReference Include="AngleSharp" Version="1.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" PrivateAssets="all" />
</ItemGroup>
</Project>
@@ -0,0 +1,31 @@
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using Xunit;
public sealed class BunitCompatibilityTests : BunitContext
{
[Fact]
public void Render_query_click_rerender_and_authorization_are_available()
{
var auth = this.AddAuthorization();
auth.SetAuthorized("synthetic-user");
auth.SetRoles("Viewer");
var cut = Render<Probe>();
Assert.Equal("Count 0", cut.Find("button").TextContent);
cut.Find("button").Click();
Assert.Equal("Count 1", cut.Find("button").TextContent);
Assert.Single(cut.FindAll("button"));
}
public sealed class Probe : ComponentBase
{
private int count;
protected override void BuildRenderTree(RenderTreeBuilder b)
{
b.OpenElement(0, "button");
b.AddAttribute(1, "onclick", EventCallback.Factory.Create(this, () => count++));
b.AddContent(2, $"Count {count}");
b.CloseElement();
}
}
}
@@ -0,0 +1,6 @@
BunitCompatibility -> /tmp/scada-bunit-compat/1.5.0/bin/Release/net10.0/BunitCompatibility.dll
Test run for /tmp/scada-bunit-compat/1.5.0/bin/Release/net10.0/BunitCompatibility.dll (.NETCoreApp,Version=v10.0)
A total of 1 test files matched the specified pattern.
Results File: /tmp/scada-bunit-compat/1.5.0/results/probe.trx
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 157 ms - BunitCompatibility.dll (net10.0)
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<TestRun id="b9cdd27c-bfd2-48ab-ab2f-a1b25af2216d" name="@Josephs-MacBook-Pro 2026-11-13 14:34:25" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Times creation="2026-11-13T14:34:25.2202860-05:00" queuing="2026-11-13T14:34:25.2202860-05:00" start="2026-11-13T14:34:24.7294910-05:00" finish="2026-11-13T14:34:25.2226430-05:00" />
<TestSettings name="default" id="7b7cab1f-ec7b-48ef-a6e2-4fbb458a96bd">
<Deployment runDeploymentRoot="_Josephs-MacBook-Pro_2026-11-13_14_34_25" />
</TestSettings>
<Results>
<UnitTestResult executionId="5d84c4d5-919a-4aa2-99a2-d5c92e40dbc4" testId="f7fb5bbe-0a69-cccc-40ad-e00d5fffbf50" testName="BunitCompatibilityTests.Render_query_click_rerender_and_authorization_are_available" computerName="Josephs-MacBook-Pro" duration="00:00:00.1553727" startTime="2026-11-13T14:34:25.0117160-05:00" endTime="2026-11-13T14:34:25.1693720-05:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="5d84c4d5-919a-4aa2-99a2-d5c92e40dbc4" />
</Results>
<TestDefinitions>
<UnitTest name="BunitCompatibilityTests.Render_query_click_rerender_and_authorization_are_available" storage="/tmp/scada-bunit-compat/1.5.0/bin/release/net10.0/bunitcompatibility.dll" id="f7fb5bbe-0a69-cccc-40ad-e00d5fffbf50">
<Execution id="5d84c4d5-919a-4aa2-99a2-d5c92e40dbc4" />
<TestMethod codeBase="/tmp/scada-bunit-compat/1.5.0/bin/Release/net10.0/BunitCompatibility.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="BunitCompatibilityTests" name="Render_query_click_rerender_and_authorization_are_available" />
</UnitTest>
</TestDefinitions>
<TestEntries>
<TestEntry testId="f7fb5bbe-0a69-cccc-40ad-e00d5fffbf50" executionId="5d84c4d5-919a-4aa2-99a2-d5c92e40dbc4" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
</TestEntries>
<TestLists>
<TestList name="Results Not in a List" id="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestList name="All Loaded Results" id="19431567-8539-422a-85d7-44ee4e166bda" />
</TestLists>
<ResultSummary outcome="Completed">
<Counters total="1" executed="1" passed="1" failed="0" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
<Output>
<StdOut>[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14)
[xUnit.net 00:00:00.03] Discovering: BunitCompatibility
[xUnit.net 00:00:00.05] Discovered: BunitCompatibility
[xUnit.net 00:00:00.05] Starting: BunitCompatibility
[xUnit.net 00:00:00.23] Finished: BunitCompatibility
</StdOut>
</Output>
</ResultSummary>
</TestRun>