Add braces to single-statement guards and refactor NordPool price fetching
- Expand inline guard, return and logger blocks across the monitor services, init classes and tests - Have INordPoolPriceService take a per-date fetch delegate and expose ParseAndAdjust, moving the HA fetch call into NordPoolInit so the service can be registered singleton - Record the NordPool and boiler service lifetimes in AGENTS.md - Drop the unused persisted-state argument from the boiler test data helper
This commit is contained in:
@@ -23,6 +23,7 @@ public class NordPoolInitTests
|
||||
private readonly Mock<ILogger<NordPoolInit>> _loggerMock;
|
||||
private readonly Mock<INordPoolPriceService> _priceServiceMock;
|
||||
private readonly Mock<IScheduler> _schedulerMock;
|
||||
private readonly Services _services;
|
||||
|
||||
public NordPoolInitTests()
|
||||
{
|
||||
@@ -35,8 +36,11 @@ public class NordPoolInitTests
|
||||
_boilerConfigProviderMock = new Mock<INordPoolBoilerConfigProvider>();
|
||||
_haContextMock = new Mock<IHaContext>();
|
||||
_entities = new Entities(_haContextMock.Object);
|
||||
_services = new Services(_haContextMock.Object);
|
||||
|
||||
_priceServiceMock.Setup(p => p.FetchPricesAsync()).Returns(Task.CompletedTask);
|
||||
_priceServiceMock
|
||||
.Setup(p => p.FetchPricesAsync(It.IsAny<Func<DateOnly, Task<NordPoolPrice>>>()))
|
||||
.Returns(Task.CompletedTask);
|
||||
_entityServiceMock.Setup(e => e.CleanupEntitiesAsync(It.IsAny<CancellationToken>()))
|
||||
.Returns(Task.CompletedTask);
|
||||
_entityServiceMock.Setup(e => e.CreateEntitiesAsync(It.IsAny<string>())).Returns(Task.CompletedTask);
|
||||
@@ -70,6 +74,7 @@ public class NordPoolInitTests
|
||||
|
||||
return new NordPoolInit(
|
||||
_entities,
|
||||
_services,
|
||||
_haContextMock.Object,
|
||||
_loggerMock.Object,
|
||||
_priceServiceMock.Object,
|
||||
|
||||
Reference in New Issue
Block a user