Skip to content

Commit 369936c

Browse files
authored
test(report): enhance report verification with parameterized data (#233)
1 parent 158f8f6 commit 369936c

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Chapter-1-initial-architecture/Src/Fitnet.IntegrationTests/Reports/GenerateNewPassesPerMonthReport/GenerateNewPassesPerMonthReportTests.Given_valid_generate_new_report_request_Then_should_return_correct_data.verified.txt renamed to Chapter-1-initial-architecture/Src/Fitnet.IntegrationTests/Reports/GenerateNewPassesPerMonthReport/GenerateNewPassesPerMonthReportTests.Given_valid_generate_new_report_request_Then_should_return_correct_data_passRegistrationDateRanges=13.verified.txt

File renamed without changes.

Chapter-1-initial-architecture/Src/Fitnet.IntegrationTests/Reports/GenerateNewPassesPerMonthReport/GenerateNewPassesPerMonthReportTests.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace EvolutionaryArchitecture.Fitnet.IntegrationTests.Reports.GenerateNewPassesPerMonthReport;
22

3-
using System;
43
using Common.TestEngine.Configuration;
54
using Common.TestEngine.IntegrationEvents.Handlers;
65
using Common.TestEngine.Time;
@@ -25,6 +24,14 @@ public GenerateNewPassesPerMonthReportTests(WebApplicationFactory<Program> appli
2524
_applicationHttpClient = _applicationInMemoryFactory.CreateClient();
2625
}
2726

27+
public ValueTask InitializeAsync() => ValueTask.CompletedTask;
28+
29+
public async ValueTask DisposeAsync()
30+
{
31+
_applicationHttpClient.Dispose();
32+
await _applicationInMemoryFactory.DisposeAsync();
33+
}
34+
2835
[Theory]
2936
[ClassData(typeof(ReportTestCases))]
3037
internal async Task Given_valid_generate_new_report_request_Then_should_return_correct_data(
@@ -39,7 +46,7 @@ internal async Task Given_valid_generate_new_report_request_Then_should_return_c
3946
// Assert
4047
getReportResult.StatusCode.ShouldBe(HttpStatusCode.OK);
4148
var reportData = await getReportResult.Content.ReadFromJsonAsync<NewPassesRegistrationsPerMonthResponse>(TestContext.Current.CancellationToken);
42-
await Verify(reportData);
49+
await Verify(reportData).UseParameters(passRegistrationDateRanges.Count);
4350
}
4451

4552
private async Task RegisterPasses(List<PassRegistrationDateRange> reportTestData)
@@ -58,12 +65,4 @@ private async Task RegisterPass(DateTimeOffset from, DateTimeOffset to)
5865
var @event = ContractSignedEventFaker.Create(from, to);
5966
await integrationEventHandler.Handle(@event, CancellationToken.None);
6067
}
61-
62-
public ValueTask InitializeAsync() => ValueTask.CompletedTask;
63-
64-
public async ValueTask DisposeAsync()
65-
{
66-
_applicationHttpClient.Dispose();
67-
await _applicationInMemoryFactory.DisposeAsync();
68-
}
6968
}

0 commit comments

Comments
 (0)