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:
@@ -26,11 +26,15 @@ public class LightMonitorInitTests
|
||||
private LightMonitorInit CreateSut(LightMonitorOptions? options = null, Exception? subscriptionException = null)
|
||||
{
|
||||
if (subscriptionException is null)
|
||||
{
|
||||
_haContextMock.Setup(x => x.StateAllChanges())
|
||||
.Returns(_stateChangesSubject);
|
||||
}
|
||||
else
|
||||
{
|
||||
_haContextMock.Setup(x => x.StateAllChanges())
|
||||
.Throws(subscriptionException);
|
||||
}
|
||||
|
||||
return new LightMonitorInit(
|
||||
_haContextMock.Object,
|
||||
@@ -53,9 +57,13 @@ public class LightMonitorInitTests
|
||||
private void VerifyTurnOn(bool shouldTurnOn)
|
||||
{
|
||||
if (shouldTurnOn)
|
||||
{
|
||||
_lightControlServiceMock.Verify(x => x.TurnOnLight(), Times.Once);
|
||||
}
|
||||
else
|
||||
{
|
||||
_lightControlServiceMock.Verify(x => x.TurnOnLight(), Times.Never);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
Reference in New Issue
Block a user