Skip to content

Commit efa25f9

Browse files
committed
Add test for enabling AboutMe in Dashboard
1 parent 8de6213 commit efa25f9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/LinkDotNet.Blog.UnitTests/Web/Pages/Admin/DashboardTests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ namespace LinkDotNet.Blog.UnitTests.Web.Pages.Admin;
1616

1717
public class DashboardTests : TestContext
1818
{
19-
[Fact]
20-
public void ShouldNotShowAboutMeStatisticsWhenDisabled()
19+
[Theory]
20+
[InlineData(true)]
21+
[InlineData(false)]
22+
public void ShouldShowAboutMeStatisticsAccordingToConfig(bool aboutMeEnabled)
2123
{
2224
var options = new DbContextOptionsBuilder()
2325
.UseSqlite(CreateInMemoryConnection())
2426
.Options;
2527
var dashboardService = new Mock<IDashboardService>();
2628
this.AddTestAuthorization().SetAuthorized("test");
27-
Services.AddScoped(_ => CreateAppConfiguration(false));
29+
Services.AddScoped(_ => CreateAppConfiguration(aboutMeEnabled));
2830
Services.AddScoped(_ => dashboardService.Object);
2931
Services.AddScoped(_ => Mock.Of<IRepository<BlogPost>>());
3032
Services.AddScoped(_ => new BlogDbContext(options));
@@ -36,7 +38,7 @@ public void ShouldNotShowAboutMeStatisticsWhenDisabled()
3638
cut.FindComponents<DashboardCard>()
3739
.Any(c => c.Instance.Text == "About Me:")
3840
.Should()
39-
.BeFalse();
41+
.Be(aboutMeEnabled);
4042
}
4143

4244
private static AppConfiguration CreateAppConfiguration(bool aboutMeEnabled)

0 commit comments

Comments
 (0)