Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using adas_core.Application.Repositories.Interfaces;
|
||||
using adas_core.Application.Services.Interfaces;
|
||||
using adas_core.Domain.Enums;
|
||||
using adas_core.Domain.Models.AppSettings;
|
||||
using adas_core.Domain.Models.MongoModels;
|
||||
using adas_core.module.LightBeacons.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MongoDB.Bson;
|
||||
using Moq;
|
||||
using Options = Microsoft.Extensions.Options.Options;
|
||||
|
||||
namespace adas_core.Test.Services;
|
||||
|
||||
[TestFixture]
|
||||
public class LightBeaconServiceTest
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_optionsApiSettings = Options.Create(_apiSettings);
|
||||
_pocService = new Mock<IPointOfCareService>();
|
||||
_clientMessageService = new Mock<IClientMessageService>();
|
||||
_subscribersService = new Mock<ISubscribersService>();
|
||||
_logger = new Mock<ILogger<LightBeaconService>>();
|
||||
_lightBeaconRepository = new Mock<ILightBeaconRepository>();
|
||||
|
||||
_lightBeaconService = new LightBeaconService(
|
||||
_optionsApiSettings,
|
||||
_logger.Object,
|
||||
_clientMessageService.Object,
|
||||
_subscribersService.Object,
|
||||
_pocService.Object,
|
||||
_lightBeaconRepository.Object
|
||||
);
|
||||
}
|
||||
|
||||
private LightBeaconService _lightBeaconService = null!;
|
||||
|
||||
private readonly ApiSettings _apiSettings = new()
|
||||
{
|
||||
BalizaUrl = "http://localhost/info.html",
|
||||
BalizaPassword = "password"
|
||||
};
|
||||
|
||||
private IOptions<ApiSettings> _optionsApiSettings = null!;
|
||||
|
||||
private Mock<ILogger<LightBeaconService>> _logger = null!;
|
||||
private Mock<IPointOfCareService> _pocService = null!;
|
||||
private Mock<IClientMessageService> _clientMessageService = null!;
|
||||
private Mock<ISubscribersService> _subscribersService = null!;
|
||||
private Mock<ILightBeaconRepository> _lightBeaconRepository = null!;
|
||||
|
||||
[Ignore("Integration test")]
|
||||
[Test]
|
||||
public async Task GetBeaconColor()
|
||||
{
|
||||
var patient = new Patient
|
||||
{
|
||||
UnitId = ObjectId.GenerateNewId(),
|
||||
PointOfCareId = ObjectId.GenerateNewId()
|
||||
};
|
||||
|
||||
|
||||
var color = await _lightBeaconService.GetColor(patient.PointOfCareId.Value);
|
||||
|
||||
Assert.That(color, Is.EqualTo(
|
||||
LightBeaconColor.Off));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user