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,6 +1,10 @@
#region
using LightMonitor.Models;
using NetDaemon.HassModel.Entities;
#endregion
namespace LightMonitor.Manager.Tests;
/// <summary>
@@ -37,7 +41,7 @@ internal static class LightMonitorTestData
/// "below_horizon" is compared case-insensitively; unavailable, unknown, blank and
/// missing states must never turn the light on.
/// </summary>
public static TheoryData<string?, bool> SunStateTurnOnCases { get; } = new()
public static TheoryData<string?, bool> SunStateTurnOnCases { get; } = new TheoryData<string?, bool>
{
{ LightMonitorConsts.SunBelowHorizon, true },
{ LightMonitorConsts.SunBelowHorizon.ToUpperInvariant(), true },
@@ -55,7 +59,7 @@ internal static class LightMonitorTestData
/// Light states evaluated while the sun is below the horizon. Only "on" (any casing)
/// suppresses the turn on call; everything else, including missing state, turns it on.
/// </summary>
public static TheoryData<string?, bool> LightStateTurnOnCases { get; } = new()
public static TheoryData<string?, bool> LightStateTurnOnCases { get; } = new TheoryData<string?, bool>
{
{ LightMonitorConsts.LightOnState, false },
{ LightMonitorConsts.LightOnState.ToUpperInvariant(), false },
@@ -73,7 +77,7 @@ internal static class LightMonitorTestData
/// Person states checked against the "arrived home" transition.
/// Only "home" in any casing counts.
/// </summary>
public static TheoryData<string?, bool> PersonNewStateCases { get; } = new()
public static TheoryData<string?, bool> PersonNewStateCases { get; } = new TheoryData<string?, bool>
{
{ LightMonitorConsts.PersonHomeState, true },
{ "HOME", true },
@@ -92,7 +96,7 @@ internal static class LightMonitorTestData
/// Old person states for a transition to "home". Recovery from unavailable, unknown or
/// missing state must be ignored; every other old state is a real arrival.
/// </summary>
public static TheoryData<string?, bool> PersonArrivalTransitions { get; } = new()
public static TheoryData<string?, bool> PersonArrivalTransitions { get; } = new TheoryData<string?, bool>
{
{ "not_home", true },
{ "work", true },
@@ -106,7 +110,7 @@ internal static class LightMonitorTestData
/// Old sun states for a transition to "below_horizon". Recovery from unavailable, unknown
/// or missing state must be ignored.
/// </summary>
public static TheoryData<string?, bool> SunBelowHorizonTransitions { get; } = new()
public static TheoryData<string?, bool> SunBelowHorizonTransitions { get; } = new TheoryData<string?, bool>
{
{ LightMonitorConsts.SunAboveHorizon, true },
{ string.Empty, true },
@@ -171,9 +175,15 @@ internal static class LightMonitorTestData
var matrix = new TheoryData<string?[]>();
foreach (var first in PresenceStates)
foreach (var second in PresenceStates)
foreach (var third in PresenceStates)
matrix.Add([first, second, third]);
{
foreach (var second in PresenceStates)
{
foreach (var third in PresenceStates)
{
matrix.Add([first, second, third]);
}
}
}
return matrix;
}