Web-Development-with-Blazor.../Chapter13/MyBlog/MyBlog.Tests/Pages/IndexTest.razor
2023-02-17 15:28:17 +01:00

21 lines
414 B
Plaintext

@inherits TestContext
<h3>IndexTest</h3>
@code {
[Fact(DisplayName = "Checks that the Index component shows 10 posts")]
public void Shows10Blogposts()
{
// Act
var cut = Render(@<Index />);
// Assert that the content has 10 article tags (each representing a blogpost)
Assert.Equal(10, cut.FindAll("article").Count());
}
public IndexTest()
{
Services.AddScoped<IBlogApi, BlogApiMock>();
}
}