using System.Text.Json;
using BoilerMonitorManager;
using FluentAssertions;
using HomeAssistant.Entities.Interfaces;
using HomeAssistant.Models;
using Microsoft.Extensions.Logging;
using Moq;
using NetDaemon.HassModel;
using static BoilerMonitor.Models.BoilerMonitorConsts;
namespace BoilerMonitor.Manager.Tests;
public class BoilerMonitorEntityServiceTests
{
/// Every entity that CleanupEntitiesAsync is expected to remove.
private static readonly string[] CleanableEntityIds =
[
ConfigPowerEntityId,
ConfigSwitchEntityId,
ConfigPollIntervalEntityId,
ConfigHeatingThresholdEntityId,
StatusEntityId,
WaterReadyEntityId,
SkipPriceCapEntityId,
TodayRuntimeEntityId,
RemainingTimeEntityId,
BudgetPercentageEntityId,
BudgetExhaustedEntityId,
SessionCountEntityId,
BudgetOverrideEntityId,
AutoManagementEntityId
];
private readonly Mock _entityManagerMock = new();
private readonly Mock _haContextMock = new();
private readonly Mock> _loggerMock = new();
public BoilerMonitorEntityServiceTests()
{
_entityManagerMock.Setup(em => em.CreateEntityAsync(It.IsAny()))
.Returns(Task.CompletedTask);
_entityManagerMock.Setup(em => em.SetEntityState(It.IsAny(), It.IsAny()))
.Returns(Task.CompletedTask);
_entityManagerMock.Setup(em => em.SetEntityAttributes(It.IsAny(), It.IsAny