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 BoilerMonitor.Models;
|
||||
using BoilerMonitorManager;
|
||||
using FluentAssertions;
|
||||
@@ -5,6 +7,8 @@ using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Time.Testing;
|
||||
using Moq;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace BoilerMonitor.Manager.Tests;
|
||||
|
||||
public class WaterReadyServiceTests
|
||||
@@ -13,7 +17,7 @@ public class WaterReadyServiceTests
|
||||
private const double HighPowerWatts = 2150.0;
|
||||
private const int RequiredReadings = BoilerMonitorConsts.ConsecutiveReadingsRequired;
|
||||
|
||||
private readonly Mock<ILogger<WaterReadyService>> _loggerMock = new();
|
||||
private readonly Mock<ILogger<WaterReadyService>> _loggerMock = new Mock<ILogger<WaterReadyService>>();
|
||||
private readonly FakeTimeProvider _timeProvider = BoilerMonitorTestData.CreateTimeProvider();
|
||||
|
||||
private WaterReadyService CreateSut()
|
||||
@@ -25,6 +29,7 @@ public class WaterReadyServiceTests
|
||||
{
|
||||
var sut = CreateSut();
|
||||
sut.RecordHeatingObserved();
|
||||
|
||||
return sut;
|
||||
}
|
||||
|
||||
@@ -36,7 +41,11 @@ public class WaterReadyServiceTests
|
||||
double heatingThresholdWatts = Threshold)
|
||||
{
|
||||
var result = false;
|
||||
for (var i = 0; i < count; i++) result = sut.IsWaterReady(switchState, powerWatts, heatingThresholdWatts);
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
result = sut.IsWaterReady(switchState, powerWatts, heatingThresholdWatts);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -119,8 +128,10 @@ public class WaterReadyServiceTests
|
||||
|
||||
sut.ResetCooldown();
|
||||
|
||||
FeedReadings(sut, RequiredReadings).Should().BeTrue(
|
||||
"ResetCooldown clears the cooldown and counter, not the heating observation");
|
||||
FeedReadings(sut, RequiredReadings)
|
||||
.Should()
|
||||
.BeTrue(
|
||||
"ResetCooldown clears the cooldown and counter, not the heating observation");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -261,9 +272,10 @@ public class WaterReadyServiceTests
|
||||
|
||||
var result = FeedReadings(sut, RequiredReadings, powerWatts: powerWatts);
|
||||
|
||||
result.Should().Be(
|
||||
expectedBelowThreshold,
|
||||
$"{scenario}: readings below {Threshold}W are counted as 'not heating'");
|
||||
result.Should()
|
||||
.Be(
|
||||
expectedBelowThreshold,
|
||||
$"{scenario}: readings below {Threshold}W are counted as 'not heating'");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -283,7 +295,7 @@ public class WaterReadyServiceTests
|
||||
var sut = CreateSutWithHeatingObserved();
|
||||
|
||||
var result = FeedReadings(sut, RequiredReadings, powerWatts: powerWatts,
|
||||
heatingThresholdWatts: heatingThresholdWatts);
|
||||
heatingThresholdWatts: heatingThresholdWatts);
|
||||
|
||||
result.Should().Be(expected);
|
||||
}
|
||||
@@ -320,8 +332,12 @@ public class WaterReadyServiceTests
|
||||
_timeProvider.Advance(elapsed);
|
||||
|
||||
sut.IsInCooldown.Should().BeTrue();
|
||||
sut.IsWaterReady("off", 0.0, Threshold).Should().BeTrue(
|
||||
"cooldown only clears via explicit ResetCooldown, not by elapsed time");
|
||||
|
||||
sut.IsWaterReady("off", 0.0, Threshold)
|
||||
.Should()
|
||||
.BeTrue(
|
||||
"cooldown only clears via explicit ResetCooldown, not by elapsed time");
|
||||
|
||||
sut.WaterReadySince.Should().Be(triggeredAt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user