diff --git a/Chapter-2-modules-separation/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GenerateNewPassesPerMonthReport/GenerateNewPassesPerMonthReportTests.cs b/Chapter-2-modules-separation/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GenerateNewPassesPerMonthReport/GenerateNewPassesPerMonthReportTests.cs index 75ea4578..c233eac0 100644 --- a/Chapter-2-modules-separation/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GenerateNewPassesPerMonthReport/GenerateNewPassesPerMonthReportTests.cs +++ b/Chapter-2-modules-separation/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GenerateNewPassesPerMonthReport/GenerateNewPassesPerMonthReportTests.cs @@ -26,12 +26,12 @@ public GenerateNewPassesPerMonthReportTests(FitnetWebApplicationFactory _applicationHttpClient = _applicationInMemoryFactory.CreateClient(); } - [Fact] - internal async Task Given_valid_generate_new_report_request_Then_should_return_correct_data() + [Theory] + [ClassData(typeof(ReportTestCases))] + internal async Task Given_valid_generate_new_report_request_Then_should_return_correct_data(List passRegistrationDateRanges) { // Arrange - var reportTestData = ReportTestCases.GetAnnualPassesData(); - await RegisterPasses(reportTestData); + await RegisterPasses(passRegistrationDateRanges); // Act var getReportResult = await _applicationHttpClient.GetAsync(ReportsApiPaths.GenerateNewReport); diff --git a/Chapter-2-modules-separation/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GenerateNewPassesPerMonthReport/TestData/ReportTestCases.cs b/Chapter-2-modules-separation/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GenerateNewPassesPerMonthReport/TestData/ReportTestCases.cs index 8481cc53..3e88965b 100644 --- a/Chapter-2-modules-separation/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GenerateNewPassesPerMonthReport/TestData/ReportTestCases.cs +++ b/Chapter-2-modules-separation/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GenerateNewPassesPerMonthReport/TestData/ReportTestCases.cs @@ -1,61 +1,31 @@ namespace EvolutionaryArchitecture.Fitnet.Reports.IntegrationTests.GenerateNewPassesPerMonthReport.TestData; -internal static class ReportTestCases +internal sealed class ReportTestCases : IEnumerable { internal static DateTimeOffset FakeNowDate = new(2021, 1, 1, 0, 0, 0, TimeSpan.Zero); - internal static List GetAnnualPassesData() => - [ - new( - new DateTimeOffset(FakeNowDate.Year, 1, 3, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 1, 10, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 1, 5, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 1, 20, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 2, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 2, 28, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 3, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 3, 31, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 4, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 4, 30, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 5, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 5, 31, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 6, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 6, 30, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 7, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 7, 31, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 8, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 8, 31, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 9, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 9, 30, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 10, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 10, 31, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 11, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 11, 30, 1, 1, 1, TimeSpan.Zero)), - - new( - new DateTimeOffset(FakeNowDate.Year, 12, 1, 1, 1, 1, TimeSpan.Zero), - new DateTimeOffset(FakeNowDate.Year, 12, 31, 1, 1, 1, TimeSpan.Zero)) - ]; + public IEnumerator GetEnumerator() + { + yield return new object[] + { + new List + { + new(new DateTimeOffset(FakeNowDate.Year, 1, 3, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 1, 10 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 1, 5, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 1, 20 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 2, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 2, 28 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 3, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 3, 31 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 4, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 4, 30 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 5, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 5, 31 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 6, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 6, 30 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 7, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 7, 31 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 8, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 8, 31 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 9, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 9, 30 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 10, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 10, 31 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 11, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 11, 30 ,1, 1, 1,1, TimeSpan.Zero)), + new(new DateTimeOffset(FakeNowDate.Year, 12, 1, 1, 1,1, TimeSpan.Zero), new DateTimeOffset(FakeNowDate.Year, 12, 31 ,1, 1, 1,1, TimeSpan.Zero)) + } + }; + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); }