From f55ef591b0dce2411b74b9858d7d678a89798a91 Mon Sep 17 00:00:00 2001 From: bUnit bot Date: Tue, 11 Nov 2025 19:19:37 +0000 Subject: [PATCH 01/10] Set version to '3.0-preview' --- version.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.json b/version.json index b8aa58a97..bafbee5f6 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.0-preview", + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", + "version": "3.0-preview", "assemblyVersion": { "precision": "revision" }, @@ -22,4 +22,4 @@ "pathFilters": [ "./src" ] -} +} \ No newline at end of file From 1ca11297c13cd1b5bc45cbcd82a470307b7ebbe2 Mon Sep 17 00:00:00 2001 From: Egil Hansen Date: Wed, 12 Nov 2025 19:57:08 +0000 Subject: [PATCH 02/10] docs: remove syncfusion as higher tier sponsor from readme.md --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index d9ef65804..98ab4b82f 100644 --- a/README.md +++ b/README.md @@ -43,13 +43,6 @@ A huge thank you to the [sponsors of bUnit](https://github.com/sponsors/bUnit-de -
- - @syncfusion -
- Syncfusion -
-
From de452e6b77b602976383954ea9e4a642948a4b3f Mon Sep 17 00:00:00 2001 From: Egil Hansen Date: Fri, 21 Nov 2025 15:10:35 +0000 Subject: [PATCH 03/10] ci: update release workflow permissions --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e28b01c6..4f0270315 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,9 @@ jobs: runs-on: ubuntu-latest permissions: id-token: write + contents: write + issues: write + pull-requests: write steps: - name: 🛒 Checkout repository From e10f5e2e05816c13b06b03afc3ceb9f99464c992 Mon Sep 17 00:00:00 2001 From: Steven Giesel Date: Fri, 21 Nov 2025 16:42:23 +0100 Subject: [PATCH 04/10] fix: Moves cascading authentication state to service container (closes #1774) --- CHANGELOG.md | 3 +++ src/bunit/RemovedInFutureVersionAttribute.cs | 7 +++++++ .../BunitAuthorizationExtensions.cs | 3 ++- .../BunitSignOutSessionStateManager.cs | 1 + .../TestDoubles/Components/StubTest.cs | 19 +++++++++++++++++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/bunit/RemovedInFutureVersionAttribute.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index b9de2cd4d..d7d63bd15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ All notable changes to **bUnit** will be documented in this file. The project ad ## [Unreleased] +### Changed +- Registering `AuthenticationState` in the services container rather than as part of the RenderTree. Fixes [#1774](https://github.com/bUnit-dev/bUnit/issues/1774) reported by [@aayjaychan](https://github.com/aayjaychan). + ## [2.0.66] - 2025-11-11 This major release focuses on platform updates and API simplifications. diff --git a/src/bunit/RemovedInFutureVersionAttribute.cs b/src/bunit/RemovedInFutureVersionAttribute.cs new file mode 100644 index 000000000..3330d9252 --- /dev/null +++ b/src/bunit/RemovedInFutureVersionAttribute.cs @@ -0,0 +1,7 @@ +namespace Bunit; + +[AttributeUsage(AttributeTargets.All, Inherited = false)] +internal sealed class RemovedInFutureVersionAttribute(string todo) : Attribute +{ + public string Todo { get; } = todo; +} diff --git a/src/bunit/TestDoubles/Authorization/BunitAuthorizationExtensions.cs b/src/bunit/TestDoubles/Authorization/BunitAuthorizationExtensions.cs index cb7c5ad83..3bf3677f1 100644 --- a/src/bunit/TestDoubles/Authorization/BunitAuthorizationExtensions.cs +++ b/src/bunit/TestDoubles/Authorization/BunitAuthorizationExtensions.cs @@ -11,9 +11,10 @@ public partial class BunitContext /// an authenticated user, as well as adding the component to the /// test contexts render tree. /// + [RemovedInFutureVersion("SignOutSessionStateManager should be removed from the container.")] public BunitAuthorizationContext AddAuthorization() { - RenderTree.TryAdd(); + Services.AddCascadingAuthenticationState(); Services.AddSingleton(); #pragma warning disable CS0618 Services.AddSingleton(s => s.GetRequiredService()); diff --git a/src/bunit/TestDoubles/NavigationManager/BunitSignOutSessionStateManager.cs b/src/bunit/TestDoubles/NavigationManager/BunitSignOutSessionStateManager.cs index 66dc01802..b84699201 100644 --- a/src/bunit/TestDoubles/NavigationManager/BunitSignOutSessionStateManager.cs +++ b/src/bunit/TestDoubles/NavigationManager/BunitSignOutSessionStateManager.cs @@ -7,6 +7,7 @@ namespace Bunit.TestDoubles; /// that will help later to assert if the user was logged out /// #pragma warning disable CS0618 +[RemovedInFutureVersion("SignOutSessionStateManager is obsolete")] public class BunitSignOutSessionStateManager : SignOutSessionStateManager #pragma warning restore CS0618 { diff --git a/tests/bunit.tests/TestDoubles/Components/StubTest.cs b/tests/bunit.tests/TestDoubles/Components/StubTest.cs index 0f15283cb..badf4a6dd 100644 --- a/tests/bunit.tests/TestDoubles/Components/StubTest.cs +++ b/tests/bunit.tests/TestDoubles/Components/StubTest.cs @@ -1,3 +1,5 @@ +using Microsoft.AspNetCore.Components.Authorization; + namespace Bunit.TestDoubles.Components; public class StubTest : BunitContext @@ -25,4 +27,21 @@ public void Test002(string header, string attrValue) ps => ps.ShouldContain(x => x.Key == nameof(Simple1.AttrValue) && attrValue.Equals(x.Value)), ps => ps.Count.ShouldBe(2)); } + + [Fact(DisplayName = "Stubbing everything except cut keeps cascading AuthenticationState")] + public void Test003() + { + AddAuthorization(); + ComponentFactories.AddStub(c => c != typeof(AuthTestComponent)); + + var cut = Render(); + + cut.Instance.Auth.ShouldNotBeNull(); + } + + private sealed class AuthTestComponent : ComponentBase + { + [CascadingParameter] + public Task Auth { get; set; } = null!; + } } From ef021b7ea7d14c541f000c861fa8a9eb36ef192e Mon Sep 17 00:00:00 2001 From: Steven Giesel Date: Fri, 21 Nov 2025 16:47:59 +0100 Subject: [PATCH 05/10] chore: Update GitHub actions --- .github/workflows/ci.yml | 20 ++++++++++---------- .github/workflows/docs-deploy.yml | 2 +- .github/workflows/prepare-release.yml | 2 +- .github/workflows/release.yml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fa502cf8..017ee69f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: create-nuget: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 # Get all history to allow automatic versioning using MinVer @@ -77,7 +77,7 @@ jobs: dotnet pack src/bunit.generators/ -c release --output ${{ env.NUGET_DIRECTORY }} -p:ContinuousIntegrationBuild=true -p:publicrelease=true # Publish the NuGet package as an artifact, so they can be used in the following jobs - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v5 with: name: ${{ env.NUGET_PACKAGES_ARTIFACT }} if-no-files-found: error @@ -92,7 +92,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 - - uses: actions/download-artifact@v5 + - uses: actions/download-artifact@v6 with: name: ${{ env.NUGET_PACKAGES_ARTIFACT }} path: ${{ env.NUGET_DIRECTORY }} @@ -117,7 +117,7 @@ jobs: steps: - name: 🛒 Checkout repository - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -139,7 +139,7 @@ jobs: - name: 📛 Upload hang- and crash-dumps on test failure if: success() || failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: if-no-files-found: ignore name: test-dumps @@ -151,7 +151,7 @@ jobs: runs-on: ubuntu-latest needs: [ create-nuget ] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 # Get all history to allow automatic versioning using MinVer @@ -161,7 +161,7 @@ jobs: dotnet-version: | 9.0.x - - uses: actions/download-artifact@v5 + - uses: actions/download-artifact@v6 with: name: ${{ env.NUGET_PACKAGES_ARTIFACT }} path: ${{ env.NUGET_DIRECTORY }} @@ -211,7 +211,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 🛒 Checkout repository - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -264,7 +264,7 @@ jobs: if: github.event_name == 'pull_request' && github.repository_owner == 'bunit-dev' steps: - name: 'Checkout Repository' - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: 'Dependency Review' uses: actions/dependency-review-action@v4 @@ -275,7 +275,7 @@ jobs: permissions: id-token: write steps: - - uses: actions/download-artifact@v5 + - uses: actions/download-artifact@v6 with: name: ${{ env.NUGET_PACKAGES_ARTIFACT }} path: ${{ env.NUGET_DIRECTORY }} diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 22a8a40f0..ce8f2a843 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -30,7 +30,7 @@ jobs: steps: - name: 🛒 Checkout repository - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 token: ${{ secrets.BUNIT_BOT_TOKEN }} diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index ce719314d..7fc66628c 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -16,7 +16,7 @@ jobs: if: github.ref == 'refs/heads/main' && contains(fromJson('["major","minor"]'), github.event.inputs.versionIncrement) steps: - name: 🛒 Checkout repository - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 token: ${{ secrets.BUNIT_BOT_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f0270315..165efa684 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: steps: - name: 🛒 Checkout repository - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 token: ${{ secrets.BUNIT_BOT_TOKEN }} From 730386d1bb80b0d725303185a8388d0292edf7a5 Mon Sep 17 00:00:00 2001 From: Steven Giesel Date: Fri, 21 Nov 2025 16:50:27 +0100 Subject: [PATCH 06/10] chore: Update NuGet packages --- Directory.Packages.props | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1a6bd7d3b..73e40e4e4 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -23,7 +23,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -88,11 +88,11 @@ - + - - - + + + From 6fee1ee75eeed77ad12a30c676e58abd9645bf27 Mon Sep 17 00:00:00 2001 From: bUnit bot Date: Fri, 21 Nov 2025 15:51:58 +0000 Subject: [PATCH 07/10] Set version to '3.0' --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index bafbee5f6..e3c43ad47 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "3.0-preview", + "version": "3.0", "assemblyVersion": { "precision": "revision" }, From b077e9760e3e652bb2368103f93a7302f32c7d89 Mon Sep 17 00:00:00 2001 From: bUnit bot Date: Fri, 21 Nov 2025 15:51:59 +0000 Subject: [PATCH 08/10] Set version to '3.1-preview' --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index bafbee5f6..c53f76bdd 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "3.0-preview", + "version": "3.1-preview", "assemblyVersion": { "precision": "revision" }, From af3da5b9dd0ef3033d2fc8c22389b32e37bd222d Mon Sep 17 00:00:00 2001 From: Steven Giesel Date: Fri, 21 Nov 2025 16:55:44 +0100 Subject: [PATCH 09/10] fix: Set correction version in version.json --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index c53f76bdd..c42f635d4 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "3.1-preview", + "version": "2.1-preview", "assemblyVersion": { "precision": "revision" }, From fcbe2b5ca459f4bb0e073868e4ea12ba5002b030 Mon Sep 17 00:00:00 2001 From: bUnit bot Date: Fri, 21 Nov 2025 15:59:08 +0000 Subject: [PATCH 10/10] Set version to '2.1' --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index c42f635d4..1bddb4867 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.1-preview", + "version": "2.1", "assemblyVersion": { "precision": "revision" },