diff --git a/source/settlement-report/SettlementReports.IntegrationTests/Application/SettlementReports/SettlementReportFinalizeHandlerIntegrationTests.cs b/source/settlement-report/SettlementReports.IntegrationTests/Application/SettlementReports/SettlementReportFinalizeHandlerIntegrationTests.cs index e6090ca..baf948e 100644 --- a/source/settlement-report/SettlementReports.IntegrationTests/Application/SettlementReports/SettlementReportFinalizeHandlerIntegrationTests.cs +++ b/source/settlement-report/SettlementReports.IntegrationTests/Application/SettlementReports/SettlementReportFinalizeHandlerIntegrationTests.cs @@ -23,6 +23,7 @@ using Energinet.DataHub.SettlementReport.Test.Core.Fixture.Database; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; using Microsoft.EntityFrameworkCore; +using Moq; using NodaTime; using Xunit; @@ -48,6 +49,8 @@ public sealed class SettlementReportFinalizeHandlerIntegrationTests : TestBase wholesaleDatabaseFixture, SettlementReportFileBlobStorageFixture settlementReportFileBlobStorageFixture) @@ -59,6 +62,13 @@ public SettlementReportFinalizeHandlerIntegrationTests( var blobContainerClient = settlementReportFileBlobStorageFixture.CreateBlobContainerClient(); Fixture.Inject(new SettlementReportFileBlobStorage(blobContainerClient)); + + var clockMock = new Mock(); + clockMock + .Setup(clock => clock.GetCurrentInstant()) + .Returns(_instant); + + Fixture.Inject(clockMock.Object); } [Fact] @@ -117,6 +127,7 @@ public async Task FinalizeAsync_CompletesReportRequest() await using var dbContextAct = _wholesaleDatabaseFixture.DatabaseManager.CreateDbContext(); var completedRequest = await dbContextAct.SettlementReports.SingleAsync(r => r.RequestId == requestId.Id); Assert.Equal(SettlementReportStatus.Completed, completedRequest.Status); + Assert.Equal(_instant, completedRequest.EndedDateTime); } private Task MakeTestFileAsync(GeneratedSettlementReportFileDto file)