Skip to content

Commit eaf189c

Browse files
committed
refactor: Update component types in Bunit extensions and tests
1 parent 6d83368 commit eaf189c

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

Directory.Packages.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
<PackageVersion Include="NSubstitute" Version="5.3.0" />
4141
<PackageVersion Include="RavenDB.TestDriver" Version="7.0.3" />
4242
<PackageVersion Include="Shouldly" Version="4.3.0" />
43-
<PackageVersion Include="bunit" Version="2.0.24-preview" />
44-
<PackageVersion Include="bunit.generators" Version="2.0.24-preview" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
43+
<PackageVersion Include="bunit" Version="2.0.36-preview" />
4544
<PackageVersion Include="coverlet.collector" Version="6.0.4">
4645
<PrivateAssets>all</PrivateAssets>
4746
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

tests/Directory.Build.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="bunit.generators" />
2019
<PackageReference Include="bunit" />
2120
<PackageReference Include="Shouldly" />
2221
<PackageReference Include="NSubstitute" />

tests/LinkDotNet.Blog.IntegrationTests/Web/Features/Admin/BlogPostEditor/CreateNewBlogPostPageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public async Task ShouldSaveBlogPostOnSave()
4949
instantRegistry.Received(1).RunInstantJob<SimilarBlogPostJob>(Arg.Any<object>(), Arg.Any<CancellationToken>());
5050
}
5151

52-
private static void TriggerNewBlogPost(RenderedComponent<CreateNewBlogPost> cut)
52+
private static void TriggerNewBlogPost(IRenderedComponent<CreateNewBlogPost> cut)
5353
{
5454
cut.Find("#title").Input("My Title");
5555
cut.Find("#short").Input("My short Description");

tests/LinkDotNet.Blog.IntegrationTests/Web/Features/Admin/BlogPostEditor/UpdateBlogPostPageTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Components;
1313
using LinkDotNet.Blog.Web.Features.Components;
1414
using LinkDotNet.Blog.Web.Features.Services;
15+
using Microsoft.AspNetCore.Components;
1516
using Microsoft.EntityFrameworkCore;
1617
using Microsoft.Extensions.DependencyInjection;
1718
using NCronJob;
@@ -68,7 +69,7 @@ public void ShouldThrowWhenNoIdProvided()
6869
act.ShouldThrow<ArgumentNullException>();
6970
}
7071

71-
private static void TriggerUpdate(RenderedFragment cut)
72+
private static void TriggerUpdate(IRenderedComponent<IComponent> cut)
7273
{
7374
cut.Find("#short").Input("My new Description");
7475

tests/LinkDotNet.Blog.IntegrationTests/Web/Shared/ProfileTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ private static void SetupGetAll(
177177
return (repoMock, calcMock);
178178
}
179179

180-
private RenderedComponent<Profile> RenderProfileWithEmptyInformation()
180+
private IRenderedComponent<Profile> RenderProfileWithEmptyInformation()
181181
=> Render<Profile>(p => p.Add(s => s.ProfileInformation, new ProfileInformationBuilder().Build()));
182182

183-
private RenderedComponent<Profile> RenderProfileInAdmin()
183+
private IRenderedComponent<Profile> RenderProfileInAdmin()
184184
=> Render<Profile>(p => p
185185
.Add(s => s.ProfileInformation, new ProfileInformationBuilder().Build())
186186
.Add(s => s.ShowAdminActions, true));

tests/LinkDotNet.Blog.TestUtilities/BunitExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace LinkDotNet.Blog.TestUtilities;
55

66
public static class BunitExtensions
77
{
8-
public static RenderedComponent<TComponent> WaitForComponent<TComponent>(this RenderedFragment component)
8+
public static IRenderedComponent<TComponent> WaitForComponent<TComponent>(this IRenderedComponent<IComponent> component)
99
where TComponent : IComponent
1010
{
1111
component.WaitForState(component.HasComponent<TComponent>);
1212
return component.FindComponent<TComponent>();
1313
}
1414

15-
public static IReadOnlyList<RenderedComponent<TComponent>> WaitForComponents<TComponent>(this RenderedFragment component)
15+
public static IReadOnlyList<IRenderedComponent<TComponent>> WaitForComponents<TComponent>(this IRenderedComponent<IComponent> component)
1616
where TComponent : IComponent
1717
{
1818
component.WaitForState(component.HasComponent<TComponent>);

tests/LinkDotNet.Blog.UnitTests/Web/Features/Components/OgDataTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void ShouldSetCanoncialLinkWithoutQueryParameter()
7070
}
7171

7272
private static void AssertMetaTagExistsWithValue(
73-
RenderedFragment cut,
73+
IRenderedComponent<IComponent> cut,
7474
string metaTag,
7575
string metaTagValue,
7676
string? ogPropertyName = null)
@@ -87,7 +87,7 @@ private static void AssertMetaTagExistsWithValue(
8787
}
8888

8989
private static bool GetMetaTagExists(
90-
RenderedFragment cut,
90+
IRenderedComponent<IComponent> cut,
9191
string metaTag)
9292
{
9393
var metaTags = cut.FindAll("meta");

0 commit comments

Comments
 (0)