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 Microsoft.Extensions.Time.Testing;
using NetDaemon.HassModel.Entities;
using ShowerMonitor.Models;
using ShowerMonitorManager.Models;
#endregion
namespace ShowerMonitor.Manager.Tests;
/// <summary>
@@ -13,7 +17,7 @@ namespace ShowerMonitor.Manager.Tests;
internal static class ShowerMonitorTestData
{
/// <summary>Fixed base time used by all timestamp-sensitive tests.</summary>
private static readonly DateTimeOffset BaseTimestamp = new(2026, 1, 15, 12, 0, 0, TimeSpan.Zero);
private static readonly DateTimeOffset BaseTimestamp = new DateTimeOffset(2026, 1, 15, 12, 0, 0, TimeSpan.Zero);
/// <summary>Creates a fake clock positioned at <see cref="BaseTimestamp" /> unless overridden.</summary>
public static FakeTimeProvider CreateTimeProvider(DateTimeOffset? start = null)
@@ -39,15 +43,13 @@ internal static class ShowerMonitorTestData
return new ShowerMonitorOptions
{
ExhaustFanEntityId = exhaustFanEntityId,
FanRunAfterShowerMinutes = fanRunAfterShowerMinutes
?? (int)ShowerMonitorConsts.DefaultFanRunAfterShower.TotalMinutes,
FanRunAfterShowerMinutes = fanRunAfterShowerMinutes ?? (int)ShowerMonitorConsts.DefaultFanRunAfterShower.TotalMinutes,
SpikeRateThreshold = spikeRateThreshold,
MinDifferentialHumidity = minDifferentialHumidity,
PeakHumidityThreshold = peakHumidityThreshold,
ConfirmationWindowMinutes = confirmationWindowMinutes,
RecoveryDifferentialThreshold = recoveryDifferentialThreshold,
MaxShowerDurationMinutes = maxShowerDurationMinutes
?? (int)ShowerMonitorConsts.DefaultMaxShowerDuration.TotalMinutes,
MaxShowerDurationMinutes = maxShowerDurationMinutes ?? (int)ShowerMonitorConsts.DefaultMaxShowerDuration.TotalMinutes,
RateWindowSize = rateWindowSize
};
}
@@ -81,9 +83,9 @@ internal static class ShowerMonitorTestData
return
[
.. Enumerable.Range(0, sampleCount)
.Select(i => new HumiditySample(
startHumidity + ratePerMinute * i * intervalSeconds / 60.0,
TimeSpan.FromSeconds(i * intervalSeconds)))
.Select(i => new HumiditySample(
startHumidity + ratePerMinute * i * intervalSeconds / 60.0,
TimeSpan.FromSeconds(i * intervalSeconds)))
];
}