Apply code formatting cleanup across the monitor projects

- Wrap using directives in `#region` blocks across the Battery, Boiler and NordPool sources and tests
- Expand single-statement guards and loops into braced blocks
- Realign wrapped method arguments, chained calls and continuations
- Replace target-typed `new()` with explicit generic construction and empty string literals with `string.Empty`
- Flatten the boiler config expression and reindent the remaining touched files
This commit is contained in:
2026-12-01 12:33:31 +02:00
parent 77458383d1
commit f919d6b25b
115 changed files with 3115 additions and 1959 deletions
@@ -1,14 +1,18 @@
#region
using BoilerMonitor.Models.Enums;
using BoilerMonitorManager;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Moq;
#endregion
namespace BoilerMonitor.Manager.Tests;
public class BoilerControlServiceTests
{
private readonly Mock<ILogger<BoilerControlService>> _loggerMock = new();
private readonly Mock<ILogger<BoilerControlService>> _loggerMock = new Mock<ILogger<BoilerControlService>>();
private BoilerControlService CreateSut()
{
@@ -34,8 +38,9 @@ public class BoilerControlServiceTests
bool budgetExhausted,
bool budgetOverride)
{
var result = CreateSut().DetermineAction(
isNowCheap, waterReady, switchState, budgetExhausted, budgetOverride);
var result = CreateSut()
.DetermineAction(
isNowCheap, waterReady, switchState, budgetExhausted, budgetOverride);
result.Should().Be(BoilerAction.NoChange);
}
@@ -57,9 +62,10 @@ public class BoilerControlServiceTests
[InlineData("0")]
public void DetermineAction_WhenCheapAndWaterNotReadyAndBudgetAvailable_ShouldReturnTurnOn(string? switchState)
{
var result = CreateSut().DetermineAction(
true, false, switchState,
false, false);
var result = CreateSut()
.DetermineAction(
true, false, switchState,
false, false);
result.Should().Be(BoilerAction.TurnOn);
}
@@ -75,9 +81,10 @@ public class BoilerControlServiceTests
string? switchState,
BoilerAction expectedAction)
{
var result = CreateSut().DetermineAction(
true, false, switchState,
true, true);
var result = CreateSut()
.DetermineAction(
true, false, switchState,
true, true);
result.Should().Be(expectedAction);
}
@@ -93,9 +100,10 @@ public class BoilerControlServiceTests
[InlineData("oN")]
public void DetermineAction_WhenNotCheapAndSwitchIsOn_ShouldReturnTurnOff(string switchState)
{
var result = CreateSut().DetermineAction(
false, false, switchState,
false, false);
var result = CreateSut()
.DetermineAction(
false, false, switchState,
false, false);
result.Should().Be(BoilerAction.TurnOff);
}
@@ -109,9 +117,10 @@ public class BoilerControlServiceTests
bool budgetExhausted,
bool budgetOverride)
{
var result = CreateSut().DetermineAction(
true, waterReady, "on",
budgetExhausted, budgetOverride);
var result = CreateSut()
.DetermineAction(
true, waterReady, "on",
budgetExhausted, budgetOverride);
result.Should().Be(BoilerAction.TurnOff);
}
@@ -124,7 +133,7 @@ public class BoilerControlServiceTests
/// Complete truth table for a boiler that is currently ON: it may only stay on when
/// it is cheap, water is not ready and the budget is available (or overridden).
/// </summary>
public static TheoryData<bool, bool, bool, bool, BoilerAction> SwitchOnActionMatrix => new()
public static TheoryData<bool, bool, bool, bool, BoilerAction> SwitchOnActionMatrix => new TheoryData<bool, bool, bool, bool, BoilerAction>
{
{ false, false, false, false, BoilerAction.TurnOff },
{ false, false, false, true, BoilerAction.TurnOff },
@@ -153,8 +162,9 @@ public class BoilerControlServiceTests
bool budgetOverride,
BoilerAction expectedAction)
{
var result = CreateSut().DetermineAction(
isNowCheap, waterReady, "on", budgetExhausted, budgetOverride);
var result = CreateSut()
.DetermineAction(
isNowCheap, waterReady, "on", budgetExhausted, budgetOverride);
result.Should().Be(expectedAction);
}
@@ -163,7 +173,7 @@ public class BoilerControlServiceTests
/// Complete truth table for a boiler that is currently OFF: it may only turn on when
/// it is cheap, water is not ready and the budget is available (or overridden).
/// </summary>
public static TheoryData<bool, bool, bool, bool, BoilerAction> SwitchOffActionMatrix => new()
public static TheoryData<bool, bool, bool, bool, BoilerAction> SwitchOffActionMatrix => new TheoryData<bool, bool, bool, bool, BoilerAction>
{
{ false, false, false, false, BoilerAction.NoChange },
{ false, false, false, true, BoilerAction.NoChange },
@@ -192,8 +202,9 @@ public class BoilerControlServiceTests
bool budgetOverride,
BoilerAction expectedAction)
{
var result = CreateSut().DetermineAction(
isNowCheap, waterReady, "off", budgetExhausted, budgetOverride);
var result = CreateSut()
.DetermineAction(
isNowCheap, waterReady, "off", budgetExhausted, budgetOverride);
result.Should().Be(expectedAction);
}