Skip to content

Commit 0efc83a

Browse files
committed
Fixed tests again
1 parent a44d0a7 commit 0efc83a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tests/LinkDotNet.Blog.IntegrationTests/Web/Pages/Admin/UpdateBlogPostPageTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using LinkDotNet.Blog.Infrastructure.Persistence;
99
using LinkDotNet.Blog.TestUtilities;
1010
using LinkDotNet.Blog.Web.Pages.Admin;
11+
using LinkDotNet.Blog.Web.Shared;
1112
using LinkDotNet.Blog.Web.Shared.Admin;
1213
using Microsoft.EntityFrameworkCore;
1314
using Microsoft.Extensions.DependencyInjection;
@@ -28,6 +29,7 @@ public async Task ShouldSaveBlogPostOnSave()
2829
ctx.AddTestAuthorization().SetAuthorized("some username");
2930
ctx.Services.AddScoped<IRepository<BlogPost>>(_ => Repository);
3031
ctx.Services.AddScoped(_ => toastService.Object);
32+
ctx.ComponentFactories.AddStub<UploadFile>();
3133
using var cut = ctx.RenderComponent<UpdateBlogPostPage>(
3234
p => p.Add(s => s.BlogPostId, blogPost.Id));
3335
var newBlogPost = cut.FindComponent<CreateNewBlogPost>();
@@ -60,4 +62,4 @@ private static void TriggerUpdate(IRenderedFragment cut)
6062

6163
cut.Find("form").Submit();
6264
}
63-
}
65+
}

tests/LinkDotNet.Blog.UnitTests/Web/Shared/Admin/CreateNewBlogPostTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44
using FluentAssertions;
55
using LinkDotNet.Blog.Domain;
66
using LinkDotNet.Blog.TestUtilities;
7+
using LinkDotNet.Blog.Web.Shared;
78
using LinkDotNet.Blog.Web.Shared.Admin;
89
using Xunit;
910

1011
namespace LinkDotNet.Blog.UnitTests.Web.Shared.Admin;
1112

1213
public class CreateNewBlogPostTests : TestContext
1314
{
15+
public CreateNewBlogPostTests()
16+
{
17+
ComponentFactories.AddStub<UploadFile>();
18+
}
19+
1420
[Fact]
1521
public void ShouldCreateNewBlogPostWhenValidDataGiven()
1622
{
@@ -161,4 +167,4 @@ public void ShouldAcceptInputWithoutLosingFocusOrEnter()
161167
blogPost.Tags.Should().HaveCount(3);
162168
blogPost.Tags.Select(t => t.Content).Should().Contain(new[] { "Tag1", "Tag2", "Tag3" });
163169
}
164-
}
170+
}

0 commit comments

Comments
 (0)