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:
@@ -1,13 +1,13 @@
|
||||
using System.Reactive.Subjects;
|
||||
using FluentAssertions;
|
||||
using LightMonitor.Models;
|
||||
using LightMonitorManager;
|
||||
using LightMonitorManager.Interface;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using NetDaemon.HassModel;
|
||||
using NetDaemon.HassModel.Entities;
|
||||
using LightMonitorManager;
|
||||
using LightMonitorManager.Interface;
|
||||
|
||||
namespace LightMonitor.Manager.Tests;
|
||||
|
||||
@@ -16,25 +16,21 @@ public class LightMonitorInitTests
|
||||
private const string SunEntityId = LightMonitorTestData.SunEntityId;
|
||||
private const string PersonEntityId = LightMonitorTestData.PrimaryPersonEntityId;
|
||||
|
||||
private readonly Mock<IHaContext> _haContextMock = new();
|
||||
private readonly Mock<IPresenceService> _presenceServiceMock = new();
|
||||
private readonly Mock<ILightControlService> _lightControlServiceMock = new();
|
||||
private readonly Subject<StateChange> _stateChangesSubject = new();
|
||||
|
||||
private readonly LightMonitorOptions _defaultOptions = LightMonitorTestData.CreateOptions();
|
||||
|
||||
private readonly Mock<IHaContext> _haContextMock = new();
|
||||
private readonly Mock<ILightControlService> _lightControlServiceMock = new();
|
||||
private readonly Mock<IPresenceService> _presenceServiceMock = new();
|
||||
private readonly Subject<StateChange> _stateChangesSubject = new();
|
||||
|
||||
private LightMonitorInit CreateSut(LightMonitorOptions? options = null, Exception? subscriptionException = null)
|
||||
{
|
||||
if (subscriptionException is null)
|
||||
{
|
||||
_haContextMock.Setup(x => x.StateAllChanges())
|
||||
.Returns(_stateChangesSubject);
|
||||
}
|
||||
else
|
||||
{
|
||||
_haContextMock.Setup(x => x.StateAllChanges())
|
||||
.Throws(subscriptionException);
|
||||
}
|
||||
|
||||
return new LightMonitorInit(
|
||||
_haContextMock.Object,
|
||||
@@ -57,13 +53,9 @@ public class LightMonitorInitTests
|
||||
private void VerifyTurnOn(bool shouldTurnOn)
|
||||
{
|
||||
if (shouldTurnOn)
|
||||
{
|
||||
_lightControlServiceMock.Verify(x => x.TurnOnLight(), Times.Once);
|
||||
}
|
||||
else
|
||||
{
|
||||
_lightControlServiceMock.Verify(x => x.TurnOnLight(), Times.Never);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -237,7 +229,8 @@ public class LightMonitorInitTests
|
||||
{
|
||||
CreateSut();
|
||||
|
||||
EmitStateChange("sensor.sun_next_dawn", LightMonitorConsts.UnavailableState, LightMonitorConsts.SunBelowHorizon);
|
||||
EmitStateChange("sensor.sun_next_dawn", LightMonitorConsts.UnavailableState,
|
||||
LightMonitorConsts.SunBelowHorizon);
|
||||
|
||||
VerifyTurnOn(false);
|
||||
}
|
||||
@@ -262,4 +255,4 @@ public class LightMonitorInitTests
|
||||
|
||||
VerifyTurnOn(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user