feat: add PowerMonitor service registration and default configuration tests
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using FluentAssertions;
|
||||
using PowerMonitorManager.Models;
|
||||
using PowerMonitorManager.Models.Consts;
|
||||
|
||||
namespace PowerMonitor.Manager.Tests;
|
||||
|
||||
public class PowerMonitorOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void Defaults_ShouldHaveEnabledTrue()
|
||||
{
|
||||
var options = new PowerMonitorOptions();
|
||||
|
||||
options.Enabled.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Defaults_ShouldHaveExpectedPollInterval()
|
||||
{
|
||||
var options = new PowerMonitorOptions();
|
||||
|
||||
options.PollIntervalSeconds.Should().Be(PowerMonitorConsts.DefaultPollIntervalSeconds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Defaults_ShouldHaveExpectedSmoothingWindowSize()
|
||||
{
|
||||
var options = new PowerMonitorOptions();
|
||||
|
||||
options.SmoothingWindowSize.Should().Be(PowerMonitorConsts.DefaultSmoothingWindowSize);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Defaults_ShouldHaveExpectedAnomalyThreshold()
|
||||
{
|
||||
var options = new PowerMonitorOptions();
|
||||
|
||||
options.AnomalyThresholdWatts.Should().Be(PowerMonitorConsts.DefaultAnomalyThresholdWatts);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Defaults_ShouldHaveEmptyMainMeterEntityId()
|
||||
{
|
||||
var options = new PowerMonitorOptions();
|
||||
|
||||
options.MainMeterEntityId.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Defaults_ShouldHaveEmptyExcludedSensorPatterns()
|
||||
{
|
||||
var options = new PowerMonitorOptions();
|
||||
|
||||
options.ExcludedSensorPatterns.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SectionName_ShouldBePowerMonitor()
|
||||
{
|
||||
PowerMonitorOptions.SectionName.Should().Be("PowerMonitor");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Enabled_WhenSetToFalse_ShouldReturnFalse()
|
||||
{
|
||||
var options = new PowerMonitorOptions { Enabled = false };
|
||||
|
||||
options.Enabled.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user