-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMP: Improve country service testability, add test for chart list com…
…ponent.
- Loading branch information
1 parent
bc49bc6
commit 58fa3f5
Showing
10 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
Pandemic.Tracker.Web.Unit.Tests/Components/Pages/ChartListTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// --------------------------------------------------------------- | ||
// Copyright (c) Coalition of the Good-Hearted Engineers | ||
// FREE TO USE TO CONNECT THE WORLD | ||
// --------------------------------------------------------------- | ||
|
||
using Bunit; | ||
using FluentAssertions; | ||
using Pandemic.Tracker.Web.Components.Pages; | ||
|
||
namespace Pandemic.Tracker.Web.Unit.Tests.Components.Pages; | ||
|
||
public class ChartListTests : TestContext | ||
{ | ||
[Fact] | ||
public void ChartList_ShouldRenderCorrectly() | ||
{ | ||
// Act | ||
var unitUnderTest = RenderComponent<ChartList>(); | ||
|
||
// Assert | ||
unitUnderTest.Find("h1").MarkupMatches("<h1 class=\"mb-4\">Charts</h1>"); | ||
|
||
var links = unitUnderTest.FindAll("a.list-group-item"); | ||
links.Count.Should().Be(5); | ||
|
||
links[0].MarkupMatches("<a href=\"/bar-chart\" class=\"list-group-item list-group-item-action bg-primary text-white mb-2\">Bar Chart: Total Cases, Deaths, and Recovered</a>"); | ||
links[1].MarkupMatches("<a href=\"/line-chart\" class=\"list-group-item list-group-item-action bg-success text-white mb-2\">Line Chart: Cases, Deaths, and Recovered Over Time</a>"); | ||
links[2].MarkupMatches("<a href=\"/pie-chart\" class=\"list-group-item list-group-item-action bg-info text-white mb-2\">Pie Chart: Countries recovered per one million </a>"); | ||
links[3].MarkupMatches("<a href=\"/heat-map\" class=\"list-group-item list-group-item-action bg-warning text-dark mb-2\">Heat Map: Cases per One Million</a>"); | ||
links[4].MarkupMatches("<a href=\"/scatter-plot\" class=\"list-group-item list-group-item-action bg-danger text-white mb-2\">Scatter Plot: Cases vs. Population</a>"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// --------------------------------------------------------------- | ||
// Copyright (c) Coalition of the Good-Hearted Engineers | ||
// FREE TO USE TO CONNECT THE WORLD | ||
// --------------------------------------------------------------- | ||
|
||
using Pandemic.Tracker.Web.Models; | ||
|
||
namespace Pandemic.Tracker.Web.Services; | ||
|
||
public interface ICountryService | ||
{ | ||
List<Country> GetCountries(); | ||
List<Country> GetCountriesStatic(); | ||
} |