feat: add BatteryMonitor implementation with discovery, notification, and scheduling services
This commit is contained in:
@@ -48,8 +48,8 @@ public class BoilerMonitorEntityServiceTests
|
||||
public void ReadPersistedState_WithValidState_ShouldReturnPersistedValues()
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "3600");
|
||||
SetupEntityState(SessionCountEntityId, "5");
|
||||
SetupEntityState(TodayRuntimeEntityId, "7200");
|
||||
SetupEntityState(SessionCountEntityId, "3");
|
||||
SetupEntityState(SkipPriceCapEntityId, "ON");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
|
||||
@@ -58,8 +58,8 @@ public class BoilerMonitorEntityServiceTests
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result!.AccumulatedRunTime.Should().Be(TimeSpan.FromSeconds(3600));
|
||||
result.SessionCount.Should().Be(5);
|
||||
result!.AccumulatedRunTime.Should().Be(TimeSpan.FromSeconds(7200));
|
||||
result.SessionCount.Should().Be(3);
|
||||
result.SkipPriceCapState.Should().Be("ON");
|
||||
result.BudgetOverrideState.Should().Be("OFF");
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "unavailable");
|
||||
SetupEntityState(SessionCountEntityId, "5");
|
||||
SetupEntityState(SessionCountEntityId, "3");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
|
||||
@@ -103,7 +103,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "unknown");
|
||||
SetupEntityState(SessionCountEntityId, "3");
|
||||
SetupEntityState(SessionCountEntityId, "2");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
|
||||
@@ -118,7 +118,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
public void ReadPersistedState_WhenSessionCountIsUnavailable_ShouldReturnNull()
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "1800");
|
||||
SetupEntityState(TodayRuntimeEntityId, "3600");
|
||||
SetupEntityState(SessionCountEntityId, "unavailable");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
@@ -135,7 +135,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, null);
|
||||
SetupEntityState(SessionCountEntityId, "3");
|
||||
SetupEntityState(SessionCountEntityId, "2");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
|
||||
@@ -150,7 +150,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
public void ReadPersistedState_WhenSessionCountEntityDoesNotExist_ShouldReturnNull()
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "1800");
|
||||
SetupEntityState(TodayRuntimeEntityId, "3600");
|
||||
SetupEntityState(SessionCountEntityId, null);
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
@@ -167,7 +167,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "not_a_number");
|
||||
SetupEntityState(SessionCountEntityId, "3");
|
||||
SetupEntityState(SessionCountEntityId, "2");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
|
||||
@@ -182,7 +182,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
public void ReadPersistedState_WhenSessionCountIsNonNumeric_ShouldReturnNull()
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "1800");
|
||||
SetupEntityState(TodayRuntimeEntityId, "3600");
|
||||
SetupEntityState(SessionCountEntityId, "abc");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
@@ -199,7 +199,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "-100");
|
||||
SetupEntityState(SessionCountEntityId, "3");
|
||||
SetupEntityState(SessionCountEntityId, "2");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
|
||||
@@ -214,7 +214,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
public void ReadPersistedState_WhenSessionCountIsNegative_ShouldReturnNull()
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "1800");
|
||||
SetupEntityState(TodayRuntimeEntityId, "3600");
|
||||
SetupEntityState(SessionCountEntityId, "-1");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
@@ -230,8 +230,8 @@ public class BoilerMonitorEntityServiceTests
|
||||
public void ReadPersistedState_WhenSwitchEntitiesAreNull_ShouldStillReturnWithNullSwitchStates()
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "900");
|
||||
SetupEntityState(SessionCountEntityId, "2");
|
||||
SetupEntityState(TodayRuntimeEntityId, "1800");
|
||||
SetupEntityState(SessionCountEntityId, "1");
|
||||
SetupEntityState(SkipPriceCapEntityId, null);
|
||||
SetupEntityState(BudgetOverrideEntityId, null);
|
||||
|
||||
@@ -240,8 +240,8 @@ public class BoilerMonitorEntityServiceTests
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result!.AccumulatedRunTime.Should().Be(TimeSpan.FromSeconds(900));
|
||||
result.SessionCount.Should().Be(2);
|
||||
result!.AccumulatedRunTime.Should().Be(TimeSpan.FromSeconds(1800));
|
||||
result.SessionCount.Should().Be(1);
|
||||
result.SkipPriceCapState.Should().BeNull();
|
||||
result.BudgetOverrideState.Should().BeNull();
|
||||
}
|
||||
@@ -253,7 +253,7 @@ public class BoilerMonitorEntityServiceTests
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, state);
|
||||
SetupEntityState(SessionCountEntityId, "3");
|
||||
SetupEntityState(SessionCountEntityId, "2");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
|
||||
@@ -268,8 +268,8 @@ public class BoilerMonitorEntityServiceTests
|
||||
public void ReadPersistedState_WithDecimalRuntime_ShouldParseCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
SetupEntityState(TodayRuntimeEntityId, "1800.5");
|
||||
SetupEntityState(SessionCountEntityId, "2");
|
||||
SetupEntityState(TodayRuntimeEntityId, "134.66");
|
||||
SetupEntityState(SessionCountEntityId, "1");
|
||||
SetupEntityState(SkipPriceCapEntityId, "OFF");
|
||||
SetupEntityState(BudgetOverrideEntityId, "OFF");
|
||||
|
||||
@@ -278,7 +278,8 @@ public class BoilerMonitorEntityServiceTests
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result!.AccumulatedRunTime.Should().Be(TimeSpan.FromSeconds(1800.5));
|
||||
result!.AccumulatedRunTime.Should().Be(TimeSpan.FromSeconds(134.66));
|
||||
result.SessionCount.Should().Be(1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user