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,8 +1,12 @@
#region
using FluentAssertions;
using Microsoft.Extensions.Options;
using PowerMonitorManager;
using PowerMonitorManager.Models;
#endregion
namespace PowerMonitor.Manager.Tests;
public class OtherPowerCalculationServiceTests
@@ -13,12 +17,13 @@ public class OtherPowerCalculationServiceTests
{
SmoothingWindowSize = smoothingWindowSize
});
return new OtherPowerCalculationService(options);
}
#region Basic calculation
public static TheoryData<string, double, double[], double, string> CalculationCases => new()
public static TheoryData<string, double, double[], double, string> CalculationCases => new TheoryData<string, double, double[], double, string>
{
{ "two devices", 341.97, [8.55, 36.93], 296.49, "ok" },
{ "no devices", 341.97, [], 341.97, "ok" },
@@ -42,9 +47,10 @@ public class OtherPowerCalculationServiceTests
{
// Arrange
var sut = CreateSut(1);
var devices = deviceWatts
.Select((watts, index) => (entityId: $"sensor.device{index}_power", watts))
.ToDictionary(entry => entry.entityId, entry => entry.watts);
.Select((watts, index) => (entityId: $"sensor.device{index}_power", watts))
.ToDictionary(entry => entry.entityId, entry => entry.watts);
// Act
var result = sut.Calculate(totalPowerWatts, devices);
@@ -166,7 +172,11 @@ public class OtherPowerCalculationServiceTests
// Act
PowerCalculationResult? result = null;
for (var i = 0; i < 200; i++) result = sut.Calculate(200.0, new Dictionary<string, double>());
for (var i = 0; i < 200; i++)
{
result = sut.Calculate(200.0, new Dictionary<string, double>());
}
// Assert
result!.SmoothedOtherPowerWatts.Should().BeApproximately(200.0, 0.1);