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:
@@ -1,3 +1,5 @@
|
||||
#region
|
||||
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Extensions.Time.Testing;
|
||||
@@ -6,6 +8,8 @@ using ShowerMonitorManager;
|
||||
using ShowerMonitorManager.Interface;
|
||||
using ShowerMonitorManager.Models;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace ShowerMonitor.Manager.Tests;
|
||||
|
||||
public class ShowerDetectionServiceTests
|
||||
@@ -15,7 +19,7 @@ public class ShowerDetectionServiceTests
|
||||
|
||||
private DateTimeOffset Now => _timeProvider.GetUtcNow();
|
||||
|
||||
public static TheoryData<string, double, double, ShowerState> IdleThresholdCases => new()
|
||||
public static TheoryData<string, double, double, ShowerState> IdleThresholdCases => new TheoryData<string, double, double, ShowerState>
|
||||
{
|
||||
{ "both thresholds met exactly", 52.0, 44.0, ShowerState.Suspected },
|
||||
{ "rate one step under threshold", 51.98, 44.0, ShowerState.Idle },
|
||||
@@ -27,7 +31,7 @@ public class ShowerDetectionServiceTests
|
||||
{ "very large humidity spike", 1000.0, 500.0, ShowerState.Suspected }
|
||||
};
|
||||
|
||||
public static TheoryData<string, double, double, int, ShowerState> ConfirmationCases => new()
|
||||
public static TheoryData<string, double, double, int, ShowerState> ConfirmationCases => new TheoryData<string, double, double, int, ShowerState>
|
||||
{
|
||||
{ "confirmation window reached", 66.0, 49.5, 120, ShowerState.Active },
|
||||
{ "confirmation window not yet reached", 66.0, 49.5, 119, ShowerState.Suspected },
|
||||
@@ -39,14 +43,14 @@ public class ShowerDetectionServiceTests
|
||||
{ "very large humidity at confirmation", 1000.0, 900.0, 120, ShowerState.Active }
|
||||
};
|
||||
|
||||
public static TheoryData<string, double, ShowerState> RecoveryBoundaryCases => new()
|
||||
public static TheoryData<string, double, ShowerState> RecoveryBoundaryCases => new TheoryData<string, double, ShowerState>
|
||||
{
|
||||
{ "differential well under threshold", 52.0, ShowerState.Completed },
|
||||
{ "differential exactly at threshold", 50.0, ShowerState.Completed },
|
||||
{ "differential just above threshold", 49.98, ShowerState.Declining }
|
||||
};
|
||||
|
||||
public static TheoryData<string, int, ShowerState> MaxDurationCases => new()
|
||||
public static TheoryData<string, int, ShowerState> MaxDurationCases => new TheoryData<string, int, ShowerState>
|
||||
{
|
||||
{ "one second before max duration", 3_599, ShowerState.Active },
|
||||
{ "exactly at max duration", 3_600, ShowerState.Declining },
|
||||
@@ -149,16 +153,19 @@ public class ShowerDetectionServiceTests
|
||||
EvaluateBaselineAndSpike(service, start);
|
||||
|
||||
var state = service.Evaluate(
|
||||
bathroomHumidity,
|
||||
mainHomeHumidity,
|
||||
start.AddSeconds(30 + secondsAfterSpike));
|
||||
bathroomHumidity,
|
||||
mainHomeHumidity,
|
||||
start.AddSeconds(30 + secondsAfterSpike));
|
||||
|
||||
state.Should().Be(expectedState, $"scenario: {scenario}");
|
||||
service.CurrentState.Should().Be(expectedState, $"scenario: {scenario}");
|
||||
service.TodaySessionCount.Should().Be(0);
|
||||
service.LastCompletedSession.Should().BeNull();
|
||||
|
||||
if (expectedState == ShowerState.Active) service.CurrentSession.Should().NotBeNull();
|
||||
if (expectedState == ShowerState.Active)
|
||||
{
|
||||
service.CurrentSession.Should().NotBeNull();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user