2024-10-22 18:20:57 +02:00
|
|
|
|
using AutoFixture;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
using Bit.Core.Services;
|
2024-10-22 18:20:57 +02:00
|
|
|
|
using Bit.Test.Common.AutoFixture;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NSubstitute;
|
|
|
|
|
using Xunit;
|
2024-10-22 18:20:57 +02:00
|
|
|
|
using GlobalSettingsCustomization = Bit.Test.Common.AutoFixture.GlobalSettings;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.Services;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2019-07-06 05:35:54 +02:00
|
|
|
|
public class MultiServicePushNotificationServiceTests
|
|
|
|
|
{
|
|
|
|
|
private readonly MultiServicePushNotificationService _sut;
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<MultiServicePushNotificationService> _logger;
|
|
|
|
|
private readonly ILogger<RelayPushNotificationService> _relayLogger;
|
|
|
|
|
private readonly ILogger<NotificationsApiPushNotificationService> _hubLogger;
|
2024-10-22 18:20:57 +02:00
|
|
|
|
private readonly IEnumerable<IPushNotificationService> _services;
|
|
|
|
|
private readonly Settings.GlobalSettings _globalSettings;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
|
|
|
|
|
public MultiServicePushNotificationServiceTests()
|
|
|
|
|
{
|
|
|
|
|
_logger = Substitute.For<ILogger<MultiServicePushNotificationService>>();
|
|
|
|
|
_relayLogger = Substitute.For<ILogger<RelayPushNotificationService>>();
|
|
|
|
|
_hubLogger = Substitute.For<ILogger<NotificationsApiPushNotificationService>>();
|
|
|
|
|
|
2024-10-22 18:20:57 +02:00
|
|
|
|
var fixture = new Fixture().WithAutoNSubstitutions().Customize(new GlobalSettingsCustomization());
|
|
|
|
|
_services = fixture.CreateMany<IPushNotificationService>();
|
|
|
|
|
_globalSettings = fixture.Create<Settings.GlobalSettings>();
|
|
|
|
|
|
2019-07-06 05:35:54 +02:00
|
|
|
|
_sut = new MultiServicePushNotificationService(
|
2024-10-22 18:20:57 +02:00
|
|
|
|
_services,
|
2019-07-06 05:35:54 +02:00
|
|
|
|
_logger,
|
2024-10-22 18:20:57 +02:00
|
|
|
|
_globalSettings
|
2019-07-06 05:35:54 +02:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove this test when we add actual tests. It only proves that
|
|
|
|
|
// we've properly constructed the system under test.
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ServiceExists()
|
|
|
|
|
{
|
|
|
|
|
Assert.NotNull(_sut);
|
|
|
|
|
}
|
|
|
|
|
}
|