mirror of
https://github.com/PacktPublishing/Web-Development-with-Blazor-Second-Edition.git
synced 2025-12-06 05:32:03 +01:00
21 lines
414 B
Plaintext
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>();
|
|
}
|
|
|
|
}
|