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,5 +1,9 @@
#region
using FluentAssertions;
#endregion
namespace BoilerMonitor.Manager.Tests;
public class BoilerMonitorConfigTests
@@ -7,7 +11,7 @@ public class BoilerMonitorConfigTests
private const string PowerEntityId = BoilerMonitorTestData.PowerEntityId;
private const string SwitchEntityId = BoilerMonitorTestData.SwitchEntityId;
public static TheoryData<string, string?, string?, int?, double?, bool> ConfigurationCases => new()
public static TheoryData<string, string?, string?, int?, double?, bool> ConfigurationCases => new TheoryData<string, string?, string?, int?, double?, bool>
{
{ "fully configured", PowerEntityId, SwitchEntityId, 30, 5.0, true },
{ "minimum valid poll interval and threshold", PowerEntityId, SwitchEntityId, 5, 1.0, true },
@@ -18,11 +22,11 @@ public class BoilerMonitorConfigTests
{ "infinite threshold", PowerEntityId, SwitchEntityId, 30, double.PositiveInfinity, true },
{ "power entity id null", null, SwitchEntityId, 30, 5.0, false },
{ "power entity id empty", "", SwitchEntityId, 30, 5.0, false },
{ "power entity id empty", string.Empty, SwitchEntityId, 30, 5.0, false },
{ "power entity id whitespace", " ", SwitchEntityId, 30, 5.0, false },
{ "power entity id tabs and newlines", "\t\n", SwitchEntityId, 30, 5.0, false },
{ "switch entity id null", PowerEntityId, null, 30, 5.0, false },
{ "switch entity id empty", PowerEntityId, "", 30, 5.0, false },
{ "switch entity id empty", PowerEntityId, string.Empty, 30, 5.0, false },
{ "switch entity id whitespace", PowerEntityId, " ", 30, 5.0, false },
{ "both entity ids null", null, null, 30, 5.0, false },
@@ -50,10 +54,10 @@ public class BoilerMonitorConfigTests
bool expected)
{
var config = BoilerMonitorTestData.CreateConfig(
powerEntityId,
switchEntityId,
pollIntervalSeconds,
heatingPowerThresholdWatts);
powerEntityId,
switchEntityId,
pollIntervalSeconds,
heatingPowerThresholdWatts);
config.IsFullyConfigured.Should().Be(expected, scenario);
}
@@ -62,8 +66,8 @@ public class BoilerMonitorConfigTests
public void IsFullyConfigured_WhenFullyPopulated_ShouldNotDependOnEntityIdCasingOrPadding()
{
var config = BoilerMonitorTestData.CreateConfig(
" sensor.sonoff_1002230e32_power ",
"SWITCH.SONOFF_1002230E32");
" sensor.sonoff_1002230e32_power ",
"SWITCH.SONOFF_1002230E32");
config.IsFullyConfigured.Should().BeTrue("entity ids are only checked for non-whitespace content");
}