Skip to content

Commit 2f4d206

Browse files
Bump bunit from 1.36.0 to 2.6.2 (#104)
Updated [bunit](https://github.com/bUnit-dev/bUnit) from 1.36.0 to 2.6.2. <details> <summary>Release notes</summary> _Sourced from [bunit's releases](https://github.com/bUnit-dev/bUnit/releases)._ ## 2.6.2 ### Added - net11.0 support ## 2.5.3 ### Added - `Render(RenderFragment)` is preferred via the `OverloadResolutionAttribute`. Reported by [@​ScarletKuro](https://github.com/ScarletKuro) in #​1800. Fixed by [@​linkdotnet](https://github.com/linkdotnet). - `FindByTestId` to `bunit.web.query` to gather elements by a given test id. By [@​jimSampica](https://github.com/jimSampica) ## 2.4.2 ### Fixed - Use proper return typed for `InputAsync` and `ChangeAsync` methods. ## 2.3.4 ### Added - Added generic overloads `Find{TComponent, TElement}` and `FindAll{TComponent, TElement}` to query for specific element types (e.g., `IHtmlInputElement`). By [@​linkdotnet](https://github.com/linkdotnet). - Added generic overloads `WaitForElement{TComponent, TElement}` and `WaitForElements{TComponent, TElement}` to wait for specific element types. By [@​linkdotnet](https://github.com/linkdotnet). ### Fixed - Adding convenient overloads for `InputAsync` and `ChangeAsync` to have feature parity with the sync version. Reported by [@​ScarletKuro](https://github.com/ScarletKuro). Fixed by [@​linkdotnet](https://github.com/linkdotnet). ## 2.2.2 ### Added - Added `FindByAllByLabel` to `bunit.web.query` package. By [@​linkdotnet](https://github.com/linkdotnet). ### Fixed - Updated `AngleSharp.Diffing` to fix a bug related to unknown HTML elements. Reported by [@​md-at-slashwhy](https://github.com/md-at-slashwhy). ## 2.1.1 ### Changed - Registering `AuthenticationState` in the services container rather than as part of the RenderTree. Fixes [#​1774](bUnit-dev/bUnit#1774) reported by [@​aayjaychan](https://github.com/aayjaychan). ## 2.0.66 This major release focuses on platform updates and API simplifications. For a migration guide, see [Upgrading bUnit](https://bunit.dev/docs/migrations/index.html). ### Changed - Target framework support updated: added support for .NET 10 (`net10.0`) and dropped all versions prior to .NET 8 (`net8.0`). - Cleanup of the API with simplifications of many API calls and methods. This also includes renaming of some objects to better reflect their purpose. ### Added - Support for form submission from submit buttons and inputs that are outside the form element but associated via the HTML5 `form` attribute. Reported and fixed in [#​1766](bUnit-dev/bUnit#1766). - Improved renderer logic that catches more edge cases. - Improved developer experience in relation to JSInterop. ## 1.40.0 ### Fixed - Aligned Microsoft packages to their TFM version ## 1.39.5 ### Fixed - Do not set the `Uri` or `BaseUri` property on the `FakeNavigationManager` if navigation is prevented by a handler on `net7.0` or greater. Reported and fixed by [@​ayyron-dev](https://github.com/ayyron-dev) in [#​1647](bUnit-dev/bUnit#1647) - Use default renderer properties for AngleSharp. Reported by [@​jtleaming](https://github.com/jtleaming) in [#​1692]. - `FindComponents` throws an exception, when a base and derived class was searched for. Reported by [@​BlueDragon709](https://github.com/BlueDragon709) in [#​1691]. ## 1.38.5 ### Added - Added support for xunit v3 in the bunit.template. By [@​linkdotnet](https://github.com/linkdotnet). ## 1.37.7 ### Added - Added support for `RendererInfo` and `AssignedRenderMode` (`.net9.0`). Commits viewable in [compare view](bUnit-dev/bUnit@v1.36.0...v2.6.2). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Philip Woulfe <philip.woulfe@gmail.com>
1 parent 09dcb25 commit 2f4d206

9 files changed

Lines changed: 37 additions & 37 deletions

src/F1.Web/F1.Web.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<ItemGroup>
1010
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.24" />
1111
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.24" />
12-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.3" PrivateAssets="all" />
13-
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.3" />
12+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.24" PrivateAssets="all" />
13+
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
1414
</ItemGroup>
1515

1616
</Project>

tests/F1.Api.Tests/F1.Api.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2626
<PrivateAssets>all</PrivateAssets>
2727
</PackageReference>
28-
<PackageReference Include="bunit" Version="1.36.0" />
28+
<PackageReference Include="bunit" Version="2.6.2" />
2929
<PackageReference Include="Moq" Version="4.20.72" />
3030
</ItemGroup>
3131

tests/F1.Web.Tests/AustraliaSelectionTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace F1.Web.Tests.Pages;
99

10-
public class AustraliaSelectionTests : TestContext
10+
public class AustraliaSelectionTests : BunitContext
1111
{
1212
private static readonly RaceConfig DefaultRaceConfig = new()
1313
{
@@ -33,7 +33,7 @@ public void AustraliaSelection_ShouldRenderWarningAndCountdown_WhenLoadedWithNoE
3333

3434
Services.AddSingleton(new HttpClient(handler) { BaseAddress = new Uri("http://localhost") });
3535

36-
var cut = RenderComponent<AustraliaSelection>();
36+
var cut = Render<AustraliaSelection>();
3737

3838
cut.WaitForAssertion(() => Assert.Contains("Locking for Pre-Qualy gives +50% points", cut.Markup));
3939
Assert.Contains("Countdown:", cut.Markup);
@@ -64,7 +64,7 @@ public void AustraliaSelection_ShouldRenderLockedState_WhenExistingSelectionIsLo
6464

6565
Services.AddSingleton(new HttpClient(handler) { BaseAddress = new Uri("http://localhost") });
6666

67-
var cut = RenderComponent<AustraliaSelection>();
67+
var cut = Render<AustraliaSelection>();
6868

6969
cut.WaitForAssertion(() => Assert.Contains("This pre-qualy selection is locked.", cut.Markup));
7070
Assert.True(cut.Find("button[type='submit']").HasAttribute("disabled"));
@@ -105,7 +105,7 @@ public void AustraliaSelection_ShouldSaveSelection_WhenSubmitSucceeds()
105105

106106
Services.AddSingleton(new HttpClient(handler) { BaseAddress = new Uri("http://localhost") });
107107

108-
var cut = RenderComponent<AustraliaSelection>();
108+
var cut = Render<AustraliaSelection>();
109109
cut.WaitForAssertion(() => Assert.Equal(5, cut.FindAll("select").Count));
110110

111111
ChangeSelect(cut, 0, "norris");
@@ -138,7 +138,7 @@ public void AustraliaSelection_ShouldShowApiErrorMessage_WhenSaveFails()
138138

139139
Services.AddSingleton(new HttpClient(handler) { BaseAddress = new Uri("http://localhost") });
140140

141-
var cut = RenderComponent<AustraliaSelection>();
141+
var cut = Render<AustraliaSelection>();
142142
cut.WaitForAssertion(() => Assert.Equal(5, cut.FindAll("select").Count));
143143

144144
cut.Find("button[type='submit']").Click();
@@ -159,7 +159,7 @@ public async Task AustraliaSelection_DisposeAsync_ShouldBeIdempotent()
159159

160160
Services.AddSingleton(new HttpClient(handler) { BaseAddress = new Uri("http://localhost") });
161161

162-
var cut = RenderComponent<AustraliaSelection>();
162+
var cut = Render<AustraliaSelection>();
163163
cut.WaitForAssertion(() => Assert.Contains("Countdown:", cut.Markup));
164164

165165
var component = (IAsyncDisposable)cut.Instance;

tests/F1.Web.Tests/CustomAuthenticationStateProviderTests.cs

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

77
namespace F1.Web.Tests.Services
88
{
9-
public class CustomAuthenticationStateProviderTests : TestContext
9+
public class CustomAuthenticationStateProviderTests : BunitContext
1010
{
1111
private readonly Mock<IUserSession> _userSessionMock;
1212
private readonly CustomAuthenticationStateProvider _authenticationStateProvider;

tests/F1.Web.Tests/DriversTests.cs

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

99
namespace F1.Web.Tests.Pages
1010
{
11-
public class DriversTests : TestContext
11+
public class DriversTests : BunitContext
1212
{
1313
private readonly Mock<HttpMessageHandler> _handlerMock;
1414
private readonly HttpClient _httpClient;
@@ -37,7 +37,7 @@ public void Drivers_ShouldRenderLoading_WhenDataIsBeingFetched()
3737
.Returns(tcs.Task);
3838

3939
// Act
40-
var cut = RenderComponent<Drivers>();
40+
var cut = Render<Drivers>();
4141

4242
// Assert
4343
Assert.Contains("Loading...", cut.Markup);
@@ -75,7 +75,7 @@ public void Drivers_ShouldRenderTable_WhenApiReturnsData()
7575
.ReturnsAsync(response);
7676

7777
// Act
78-
var cut = RenderComponent<Drivers>();
78+
var cut = Render<Drivers>();
7979

8080
// Assert
8181
cut.WaitForState(() => cut.FindAll("tbody tr").Count > 0);
@@ -98,7 +98,7 @@ public void Drivers_ShouldShowError_WhenApiCallFails()
9898
.ThrowsAsync(new HttpRequestException("API is down"));
9999

100100
// Act
101-
var cut = RenderComponent<Drivers>();
101+
var cut = Render<Drivers>();
102102

103103
// Assert
104104
cut.WaitForState(() => cut.FindAll("div.alert.alert-danger").Count > 0);

tests/F1.Web.Tests/F1.Web.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
<PrivateAssets>all</PrivateAssets>
2626
</PackageReference>
27-
<PackageReference Include="bunit" Version="1.36.0" />
27+
<PackageReference Include="bunit" Version="2.6.2" />
2828
<PackageReference Include="Moq" Version="4.20.72" />
2929
</ItemGroup>
3030

tests/F1.Web.Tests/MainLayoutTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
namespace F1.Web.Tests.Layout;
1010

11-
public class MainLayoutTests : TestContext
11+
public class MainLayoutTests : BunitContext
1212
{
1313
[Fact]
1414
public void MainLayout_ShouldShowDevelopmentBanner_AndToggleButton_InDevelopment()
1515
{
16-
var auth = this.AddTestAuthorization();
16+
var auth = this.AddAuthorization();
1717
auth.SetNotAuthorized();
1818

1919
var userSession = new Mock<IUserSession>();
@@ -24,7 +24,7 @@ public void MainLayout_ShouldShowDevelopmentBanner_AndToggleButton_InDevelopment
2424
Services.AddSingleton<IWebAssemblyHostEnvironment>(new TestHostEnvironment("Development"));
2525
Services.AddSingleton(new HttpClient(new HttpClientHandler()) { BaseAddress = new Uri("http://localhost") });
2626

27-
var cut = RenderComponent<MainLayout>(parameters =>
27+
var cut = Render<MainLayout>(parameters =>
2828
parameters.Add(p => p.Body, (builder) => builder.AddMarkupContent(0, "<p>Body</p>")));
2929

3030
cut.WaitForAssertion(() => Assert.Contains("DEVELOPMENT MODE", cut.Markup));
@@ -34,7 +34,7 @@ public void MainLayout_ShouldShowDevelopmentBanner_AndToggleButton_InDevelopment
3434
[Fact]
3535
public void MainLayout_ShouldShowQaBanner_InTestEnvironment()
3636
{
37-
var auth = this.AddTestAuthorization();
37+
var auth = this.AddAuthorization();
3838
auth.SetNotAuthorized();
3939

4040
var userSession = new Mock<IUserSession>();
@@ -44,7 +44,7 @@ public void MainLayout_ShouldShowQaBanner_InTestEnvironment()
4444
Services.AddSingleton<IWebAssemblyHostEnvironment>(new TestHostEnvironment("Test"));
4545
Services.AddSingleton(new HttpClient(new HttpClientHandler()) { BaseAddress = new Uri("http://localhost") });
4646

47-
var cut = RenderComponent<MainLayout>(parameters =>
47+
var cut = Render<MainLayout>(parameters =>
4848
parameters.Add(p => p.Body, (builder) => builder.AddMarkupContent(0, "<p>Body</p>")));
4949

5050
cut.WaitForAssertion(() => Assert.Contains("QA ENVIRONMENT", cut.Markup));
@@ -53,7 +53,7 @@ public void MainLayout_ShouldShowQaBanner_InTestEnvironment()
5353
[Fact]
5454
public void MainLayout_ShouldShowVersionFooter_InProduction()
5555
{
56-
var auth = this.AddTestAuthorization();
56+
var auth = this.AddAuthorization();
5757
auth.SetNotAuthorized();
5858

5959
var userSession = new Mock<IUserSession>();
@@ -63,7 +63,7 @@ public void MainLayout_ShouldShowVersionFooter_InProduction()
6363
Services.AddSingleton<IWebAssemblyHostEnvironment>(new TestHostEnvironment("Production"));
6464
Services.AddSingleton(new HttpClient(new HttpClientHandler()) { BaseAddress = new Uri("http://localhost") });
6565

66-
var cut = RenderComponent<MainLayout>(parameters =>
66+
var cut = Render<MainLayout>(parameters =>
6767
parameters.Add(p => p.Body, (builder) => builder.AddMarkupContent(0, "<p>Body</p>")));
6868

6969
cut.WaitForAssertion(() => Assert.Contains("v. ", cut.Markup));

tests/F1.Web.Tests/NavMenuTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
namespace F1.Web.Tests.Layout;
55

6-
public class NavMenuTests : TestContext
6+
public class NavMenuTests : BunitContext
77
{
88
[Fact]
99
public void NavMenu_ShouldHideAuthorizedLinks_WhenAnonymous()
1010
{
11-
var auth = this.AddTestAuthorization();
11+
var auth = this.AddAuthorization();
1212
auth.SetNotAuthorized();
1313

14-
var cut = RenderComponent<NavMenu>();
14+
var cut = Render<NavMenu>();
1515

1616
Assert.DoesNotContain("Driver Standings", cut.Markup);
1717
Assert.DoesNotContain("Australia GP", cut.Markup);
@@ -21,10 +21,10 @@ public void NavMenu_ShouldHideAuthorizedLinks_WhenAnonymous()
2121
[Fact]
2222
public void NavMenu_ShouldShowAuthorizedLinks_WhenAuthenticated()
2323
{
24-
var auth = this.AddTestAuthorization();
24+
var auth = this.AddAuthorization();
2525
auth.SetAuthorized("user@example.com");
2626

27-
var cut = RenderComponent<NavMenu>();
27+
var cut = Render<NavMenu>();
2828

2929
Assert.Contains("Driver Standings", cut.Markup);
3030
Assert.Contains("Australia GP", cut.Markup);
@@ -34,22 +34,22 @@ public void NavMenu_ShouldShowAuthorizedLinks_WhenAuthenticated()
3434
[Fact]
3535
public void NavMenu_ShouldShowAdminLink_WhenInAdminRole()
3636
{
37-
var auth = this.AddTestAuthorization();
37+
var auth = this.AddAuthorization();
3838
auth.SetAuthorized("admin@example.com");
3939
auth.SetRoles("Admin");
4040

41-
var cut = RenderComponent<NavMenu>();
41+
var cut = Render<NavMenu>();
4242

4343
Assert.Contains("Admin", cut.Markup);
4444
}
4545

4646
[Fact]
4747
public void NavMenu_ShouldToggleCollapsedState_WhenClicked()
4848
{
49-
var auth = this.AddTestAuthorization();
49+
var auth = this.AddAuthorization();
5050
auth.SetAuthorized("user@example.com");
5151

52-
var cut = RenderComponent<NavMenu>();
52+
var cut = Render<NavMenu>();
5353

5454
Assert.Contains("collapse", cut.Markup);
5555
cut.Find("button.navbar-toggler").Click();

tests/F1.Web.Tests/ResultsTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace F1.Web.Tests.Pages;
1010

11-
public class ResultsTests : TestContext
11+
public class ResultsTests : BunitContext
1212
{
1313
private readonly Mock<HttpMessageHandler> _handlerMock;
1414
private readonly HttpClient _httpClient;
@@ -37,7 +37,7 @@ public void Results_ShouldRenderLoading_WhenDataIsBeingFetched()
3737
.Returns(tcs.Task);
3838

3939
// Act
40-
var cut = RenderComponent<Results>();
40+
var cut = Render<Results>();
4141

4242
// Assert
4343
Assert.Contains("Loading race results...", cut.Markup);
@@ -75,7 +75,7 @@ public void Results_ShouldRenderTable_WhenApiReturnsData()
7575
.ReturnsAsync(response);
7676

7777
// Act
78-
var cut = RenderComponent<Results>();
78+
var cut = Render<Results>();
7979

8080
// Assert
8181
cut.WaitForState(() => cut.FindAll("tbody tr").Count > 0);
@@ -110,7 +110,7 @@ public void Results_ShouldNotBeEmpty_WhenApiReturnsData()
110110
.ReturnsAsync(response);
111111

112112
// Act
113-
var cut = RenderComponent<Results>();
113+
var cut = Render<Results>();
114114

115115
// Assert
116116
cut.WaitForState(() => cut.FindAll("tbody tr").Count > 0);
@@ -131,7 +131,7 @@ public void Results_ShouldShowError_WhenApiCallFails()
131131
.ThrowsAsync(new HttpRequestException("API is down"));
132132

133133
// Act
134-
var cut = RenderComponent<Results>();
134+
var cut = Render<Results>();
135135

136136
// Assert
137137
cut.WaitForState(() => cut.FindAll("p").Count > 0);
@@ -163,7 +163,7 @@ public void Results_ShouldCallOnInitializedAsync_WhenComponentIsRendered()
163163
.ReturnsAsync(response);
164164

165165
// Act
166-
var cut = RenderComponent<Results>();
166+
var cut = Render<Results>();
167167

168168
// Assert
169169
_handlerMock.Protected().Verify(

0 commit comments

Comments
 (0)