test(theme): verify bUnit 2.7.2 with patched DOM parser
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Bunit;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Xunit;
|
||||
public sealed class AsyncLifecycleTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task Context_awaits_async_service_disposal()
|
||||
{
|
||||
var context = new BunitContext();
|
||||
context.Services.AddScoped<AsyncResource>();
|
||||
var resource = context.Services.GetRequiredService<AsyncResource>();
|
||||
Assert.False(resource.Disposed);
|
||||
await context.DisposeAsync();
|
||||
Assert.True(resource.Disposed);
|
||||
}
|
||||
public sealed class AsyncResource : IAsyncDisposable
|
||||
{
|
||||
public bool Disposed { get; private set; }
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
await Task.Yield();
|
||||
Disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.2" />
|
||||
<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,2 @@
|
||||
Determining projects to restore...
|
||||
Restored /tmp/scada-bunit-compat/1.5.2/BunitCompatibility.csproj (in 669 ms).
|
||||
@@ -0,0 +1,6 @@
|
||||
BunitCompatibility -> /tmp/scada-bunit-compat/1.5.2/bin/Release/net10.0/BunitCompatibility.dll
|
||||
Test run for /tmp/scada-bunit-compat/1.5.2/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.2/results/probe-final.trx
|
||||
|
||||
Passed! - Failed: 0, Passed: 2, Skipped: 0, Total: 2, Duration: 158 ms - BunitCompatibility.dll (net10.0)
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TestRun id="17d883fb-59b8-4353-9158-134c9c55ebbb" name="@Josephs-MacBook-Pro 2026-11-13 14:36:16" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
|
||||
<Times creation="2026-11-13T14:36:16.7241870-05:00" queuing="2026-11-13T14:36:16.7241870-05:00" start="2026-11-13T14:36:16.2292460-05:00" finish="2026-11-13T14:36:16.7265380-05:00" />
|
||||
<TestSettings name="default" id="71732dbb-1e4d-4a58-877d-02c4b6d37c32">
|
||||
<Deployment runDeploymentRoot="_Josephs-MacBook-Pro_2026-11-13_14_36_16" />
|
||||
</TestSettings>
|
||||
<Results>
|
||||
<UnitTestResult executionId="4a5de4a0-8cf9-4f49-98f1-becc90ff286b" testId="f7fb5bbe-0a69-cccc-40ad-e00d5fffbf50" testName="BunitCompatibilityTests.Render_query_click_rerender_and_authorization_are_available" computerName="Josephs-MacBook-Pro" duration="00:00:00.1578242" startTime="2026-11-13T14:36:16.5173510-05:00" endTime="2026-11-13T14:36:16.6762280-05:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="4a5de4a0-8cf9-4f49-98f1-becc90ff286b" />
|
||||
<UnitTestResult executionId="89434d90-184f-4b6a-9f87-4054576f4b7f" testId="9bfb139c-c53e-277d-f36f-d32fcc52c2bb" testName="AsyncLifecycleTests.Context_awaits_async_service_disposal" computerName="Josephs-MacBook-Pro" duration="00:00:00.0117864" startTime="2026-11-13T14:36:16.5179280-05:00" endTime="2026-11-13T14:36:16.5319400-05:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="89434d90-184f-4b6a-9f87-4054576f4b7f" />
|
||||
</Results>
|
||||
<TestDefinitions>
|
||||
<UnitTest name="BunitCompatibilityTests.Render_query_click_rerender_and_authorization_are_available" storage="/tmp/scada-bunit-compat/1.5.2/bin/release/net10.0/bunitcompatibility.dll" id="f7fb5bbe-0a69-cccc-40ad-e00d5fffbf50">
|
||||
<Execution id="4a5de4a0-8cf9-4f49-98f1-becc90ff286b" />
|
||||
<TestMethod codeBase="/tmp/scada-bunit-compat/1.5.2/bin/Release/net10.0/BunitCompatibility.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="BunitCompatibilityTests" name="Render_query_click_rerender_and_authorization_are_available" />
|
||||
</UnitTest>
|
||||
<UnitTest name="AsyncLifecycleTests.Context_awaits_async_service_disposal" storage="/tmp/scada-bunit-compat/1.5.2/bin/release/net10.0/bunitcompatibility.dll" id="9bfb139c-c53e-277d-f36f-d32fcc52c2bb">
|
||||
<Execution id="89434d90-184f-4b6a-9f87-4054576f4b7f" />
|
||||
<TestMethod codeBase="/tmp/scada-bunit-compat/1.5.2/bin/Release/net10.0/BunitCompatibility.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="AsyncLifecycleTests" name="Context_awaits_async_service_disposal" />
|
||||
</UnitTest>
|
||||
</TestDefinitions>
|
||||
<TestEntries>
|
||||
<TestEntry testId="f7fb5bbe-0a69-cccc-40ad-e00d5fffbf50" executionId="4a5de4a0-8cf9-4f49-98f1-becc90ff286b" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
|
||||
<TestEntry testId="9bfb139c-c53e-277d-f36f-d32fcc52c2bb" executionId="89434d90-184f-4b6a-9f87-4054576f4b7f" 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="2" executed="2" passed="2" 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.06] Starting: BunitCompatibility
|
||||
[xUnit.net 00:00:00.23] Finished: BunitCompatibility
|
||||
</StdOut>
|
||||
</Output>
|
||||
</ResultSummary>
|
||||
</TestRun>
|
||||
@@ -0,0 +1,8 @@
|
||||
Determining projects to restore...
|
||||
Restored /tmp/scada-bunit-compat/1.5.2/BunitCompatibility.csproj (in 101 ms).
|
||||
BunitCompatibility -> /tmp/scada-bunit-compat/1.5.2/bin/Release/net10.0/BunitCompatibility.dll
|
||||
Test run for /tmp/scada-bunit-compat/1.5.2/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.2/results/probe.trx
|
||||
|
||||
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 166 ms - BunitCompatibility.dll (net10.0)
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TestRun id="671494e6-ed41-40a0-8e11-a2e583dfd6e0" name="@Josephs-MacBook-Pro 2026-11-13 14:32:46" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
|
||||
<Times creation="2026-11-13T14:32:46.5195820-05:00" queuing="2026-11-13T14:32:46.5195820-05:00" start="2026-11-13T14:32:46.0261670-05:00" finish="2026-11-13T14:32:46.5218280-05:00" />
|
||||
<TestSettings name="default" id="30e0fdb0-04c2-4693-91f2-706d2eaa7c35">
|
||||
<Deployment runDeploymentRoot="_Josephs-MacBook-Pro_2026-11-13_14_32_46" />
|
||||
</TestSettings>
|
||||
<Results>
|
||||
<UnitTestResult executionId="5af707e1-b5ae-4b75-af7b-a7430f288187" testId="f7fb5bbe-0a69-cccc-40ad-e00d5fffbf50" testName="BunitCompatibilityTests.Render_query_click_rerender_and_authorization_are_available" computerName="Josephs-MacBook-Pro" duration="00:00:00.1639648" startTime="2026-11-13T14:32:46.3010450-05:00" endTime="2026-11-13T14:32:46.4674860-05:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="5af707e1-b5ae-4b75-af7b-a7430f288187" />
|
||||
</Results>
|
||||
<TestDefinitions>
|
||||
<UnitTest name="BunitCompatibilityTests.Render_query_click_rerender_and_authorization_are_available" storage="/tmp/scada-bunit-compat/1.5.2/bin/release/net10.0/bunitcompatibility.dll" id="f7fb5bbe-0a69-cccc-40ad-e00d5fffbf50">
|
||||
<Execution id="5af707e1-b5ae-4b75-af7b-a7430f288187" />
|
||||
<TestMethod codeBase="/tmp/scada-bunit-compat/1.5.2/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="5af707e1-b5ae-4b75-af7b-a7430f288187" 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.06] Starting: BunitCompatibility
|
||||
[xUnit.net 00:00:00.24] Finished: BunitCompatibility
|
||||
</StdOut>
|
||||
</Output>
|
||||
</ResultSummary>
|
||||
</TestRun>
|
||||
Reference in New Issue
Block a user