feat: migrate boiler control implementation to BoilerMonitor namespace and add budget handling logic

This commit is contained in:
Marius
2026-03-24 15:29:59 +02:00
parent c4015277a3
commit 11c2574235
61 changed files with 3250 additions and 728 deletions
@@ -0,0 +1,133 @@
using FluentAssertions;
using BoilerMonitorManager.Models;
namespace BoilerMonitor.Manager.Tests;
public class BoilerMonitorConfigTests
{
[Fact]
public void IsFullyConfigured_WhenAllFieldsSet_ShouldReturnTrue()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = "sensor.power",
BoilerSwitchEntityId = "switch.boiler",
PollIntervalSeconds = 30,
HeatingPowerThresholdWatts = 5.0
};
config.IsFullyConfigured.Should().BeTrue();
}
[Fact]
public void IsFullyConfigured_WhenPowerEntityMissing_ShouldReturnFalse()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = null,
BoilerSwitchEntityId = "switch.boiler",
PollIntervalSeconds = 30,
HeatingPowerThresholdWatts = 5.0
};
config.IsFullyConfigured.Should().BeFalse();
}
[Fact]
public void IsFullyConfigured_WhenSwitchEntityMissing_ShouldReturnFalse()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = "sensor.power",
BoilerSwitchEntityId = null,
PollIntervalSeconds = 30,
HeatingPowerThresholdWatts = 5.0
};
config.IsFullyConfigured.Should().BeFalse();
}
[Fact]
public void IsFullyConfigured_WhenPollIntervalMissing_ShouldReturnFalse()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = "sensor.power",
BoilerSwitchEntityId = "switch.boiler",
PollIntervalSeconds = null,
HeatingPowerThresholdWatts = 5.0
};
config.IsFullyConfigured.Should().BeFalse();
}
[Fact]
public void IsFullyConfigured_WhenThresholdMissing_ShouldReturnFalse()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = "sensor.power",
BoilerSwitchEntityId = "switch.boiler",
PollIntervalSeconds = 30,
HeatingPowerThresholdWatts = null
};
config.IsFullyConfigured.Should().BeFalse();
}
[Fact]
public void IsFullyConfigured_WhenPowerEntityIsWhitespace_ShouldReturnFalse()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = " ",
BoilerSwitchEntityId = "switch.boiler",
PollIntervalSeconds = 30,
HeatingPowerThresholdWatts = 5.0
};
config.IsFullyConfigured.Should().BeFalse();
}
[Fact]
public void IsFullyConfigured_WhenPollIntervalIsZero_ShouldReturnFalse()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = "sensor.power",
BoilerSwitchEntityId = "switch.boiler",
PollIntervalSeconds = 0,
HeatingPowerThresholdWatts = 5.0
};
config.IsFullyConfigured.Should().BeFalse();
}
[Fact]
public void IsFullyConfigured_WhenThresholdIsZero_ShouldReturnFalse()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = "sensor.power",
BoilerSwitchEntityId = "switch.boiler",
PollIntervalSeconds = 30,
HeatingPowerThresholdWatts = 0.0
};
config.IsFullyConfigured.Should().BeFalse();
}
[Fact]
public void IsFullyConfigured_WhenPollIntervalIsNegative_ShouldReturnFalse()
{
var config = new BoilerMonitorConfig
{
BoilerPowerEntityId = "sensor.power",
BoilerSwitchEntityId = "switch.boiler",
PollIntervalSeconds = -1,
HeatingPowerThresholdWatts = 5.0
};
config.IsFullyConfigured.Should().BeFalse();
}
}