Skip to content

Commit

Permalink
fix: fix warning for not serialable theory by chaning to fact
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilbaczek committed Dec 7, 2024
1 parent 895ae83 commit 4e9130c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public GenerateNewPassesPerMonthReportTests(FitnetWebApplicationFactory<Program>
_applicationHttpClient = _applicationInMemoryFactory.CreateClient();
}

[Theory]
[ClassData(typeof(ReportTestCases))]
internal async Task Given_valid_generate_new_report_request_Then_should_return_correct_data(List<PassRegistrationDateRange> passRegistrationDateRanges)
[Fact]
internal async Task Given_valid_generate_new_report_request_Then_should_return_correct_data()
{
// Arrange
await RegisterPasses(passRegistrationDateRanges);
var reportTestData = ReportTestCases.GetAnnualPassesData();
await RegisterPasses(reportTestData);

// Act
var getReportResult = await _applicationHttpClient.GetAsync(ReportsApiPaths.GenerateNewReport);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,61 @@
namespace EvolutionaryArchitecture.Fitnet.Reports.IntegrationTests.GenerateNewPassesPerMonthReport.TestData;

internal sealed class ReportTestCases : IEnumerable<object[]>
internal static class ReportTestCases
{
internal static DateTimeOffset FakeNowDate = new(2021, 1, 1, 0, 0, 0, TimeSpan.Zero);

public IEnumerator<object[]> GetEnumerator()
{
yield return new object[]
{
new List<PassRegistrationDateRange>
{
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();
internal static List<PassRegistrationDateRange> 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))
];
}

0 comments on commit 4e9130c

Please sign in to comment.