Add cancellation token support across NordPool services and update constants for reuse
- Introduced `CancellationToken` to service methods for improved task cancellation handling. - Centralized reusable constants (`MinutesPerInterval`, `WaterReadyPowerThresholdWatts`) in `NordPoolConsts`. - Refactored `ConfigureAwait` usage and improved logging within `NordPoolEntityService`. - Adjusted tests to accommodate cancellation token changes.
This commit is contained in:
@@ -62,13 +62,13 @@ public class NordPoolInitTests
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut();
|
||||
_entityServiceMock.Setup(es => es.CleanupEntitiesAsync())
|
||||
_entityServiceMock.Setup(es => es.CleanupEntitiesAsync(It.IsAny<CancellationToken>()))
|
||||
.Returns(Task.CompletedTask);
|
||||
|
||||
// Act
|
||||
await sut.CleanupEntitiesAsync();
|
||||
|
||||
// Assert
|
||||
_entityServiceMock.Verify(es => es.CleanupEntitiesAsync(), Times.Once);
|
||||
_entityServiceMock.Verify(es => es.CleanupEntitiesAsync(It.IsAny<CancellationToken>()), Times.Once);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user