Apply code formatting cleanup across monitor projects
- Reindent appsettings.json and the MSBuild project files - Collapse single-statement guard blocks and tidy using and member order - Normalize XML doc indentation and file endings - Reorder BatteryMonitor test-data helpers and move the exclusion tests into their own region - Carry the same formatting through the boiler config, control, entity and test files
This commit is contained in:
@@ -41,7 +41,7 @@ public class OtherPowerCalculationServiceTests
|
||||
string expectedDataQuality)
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 1);
|
||||
var sut = CreateSut(1);
|
||||
var devices = deviceWatts
|
||||
.Select((watts, index) => (entityId: $"sensor.device{index}_power", watts))
|
||||
.ToDictionary(entry => entry.entityId, entry => entry.watts);
|
||||
@@ -62,7 +62,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Calculate_ShouldIncludeAllDeviceReadingsInResult()
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 1);
|
||||
var sut = CreateSut(1);
|
||||
var devices = PowerMonitorTestData.CreateCostDeviceReadings();
|
||||
|
||||
// Act
|
||||
@@ -78,7 +78,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Calculate_ShouldCopyDeviceReadingsInsteadOfAliasingThem()
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 1);
|
||||
var sut = CreateSut(1);
|
||||
var devices = new Dictionary<string, double> { ["sensor.tv_power"] = 100.0 };
|
||||
|
||||
// Act
|
||||
@@ -98,7 +98,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Calculate_FirstSample_ShouldReturnRawValueWithoutSmoothing()
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 10);
|
||||
var sut = CreateSut();
|
||||
|
||||
// Act
|
||||
var result = sut.Calculate(341.97, new Dictionary<string, double>());
|
||||
@@ -111,7 +111,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Calculate_WithSmoothing_ShouldApplyExponentialMovingAverage()
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 4);
|
||||
var sut = CreateSut(4);
|
||||
|
||||
// Act
|
||||
var result1 = sut.Calculate(341.97, new Dictionary<string, double>());
|
||||
@@ -127,7 +127,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Calculate_WithSmoothingWindowOfOne_ShouldFollowRawValueExactly()
|
||||
{
|
||||
// Arrange - alpha becomes 1, so the previous value has no influence.
|
||||
var sut = CreateSut(smoothingWindowSize: 1);
|
||||
var sut = CreateSut(1);
|
||||
|
||||
// Act
|
||||
sut.Calculate(500.0, new Dictionary<string, double>());
|
||||
@@ -141,7 +141,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Calculate_ShouldDampenSingleSpike()
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 10);
|
||||
var sut = CreateSut();
|
||||
sut.Calculate(100.0, new Dictionary<string, double>());
|
||||
|
||||
// Act
|
||||
@@ -166,10 +166,7 @@ public class OtherPowerCalculationServiceTests
|
||||
|
||||
// Act
|
||||
PowerCalculationResult? result = null;
|
||||
for (var i = 0; i < 200; i++)
|
||||
{
|
||||
result = sut.Calculate(200.0, new Dictionary<string, double>());
|
||||
}
|
||||
for (var i = 0; i < 200; i++) result = sut.Calculate(200.0, new Dictionary<string, double>());
|
||||
|
||||
// Assert
|
||||
result!.SmoothedOtherPowerWatts.Should().BeApproximately(200.0, 0.1);
|
||||
@@ -179,7 +176,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Calculate_WithGeneratedSeries_ShouldNeverOvershootTheInputRange()
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 5);
|
||||
var sut = CreateSut(5);
|
||||
var samples = PowerMonitorTestData.CreatePowerSampleSeries(50);
|
||||
|
||||
// Act
|
||||
@@ -198,7 +195,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Reset_ShouldClearSmoothedState()
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 10);
|
||||
var sut = CreateSut();
|
||||
sut.Calculate(341.97, new Dictionary<string, double>());
|
||||
sut.Calculate(341.97, new Dictionary<string, double>());
|
||||
|
||||
@@ -214,7 +211,7 @@ public class OtherPowerCalculationServiceTests
|
||||
public void Reset_WhenCalledBeforeAnyCalculation_ShouldKeepFirstSampleRaw()
|
||||
{
|
||||
// Arrange
|
||||
var sut = CreateSut(smoothingWindowSize: 10);
|
||||
var sut = CreateSut();
|
||||
|
||||
// Act
|
||||
sut.Reset();
|
||||
@@ -225,4 +222,4 @@ public class OtherPowerCalculationServiceTests
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user