1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00

PM-10600: Unit Tests fix to NotificationHubPushRegistrationService after merge conflict

This commit is contained in:
Maciej Zieniuk 2024-11-20 11:09:59 +00:00
parent ccf685f29d
commit 0aa38bed5a
No known key found for this signature in database
GPG Key ID: 9CACE59F1272ACD9
2 changed files with 0 additions and 15 deletions

View File

@ -11,18 +11,15 @@ public class NotificationHubPushRegistrationService : IPushRegistrationService
{ {
private readonly IInstallationDeviceRepository _installationDeviceRepository; private readonly IInstallationDeviceRepository _installationDeviceRepository;
private readonly INotificationHubPool _notificationHubPool; private readonly INotificationHubPool _notificationHubPool;
private readonly IServiceProvider _serviceProvider;
private readonly IOrganizationUserRepository _organizationUserRepository; private readonly IOrganizationUserRepository _organizationUserRepository;
public NotificationHubPushRegistrationService( public NotificationHubPushRegistrationService(
IInstallationDeviceRepository installationDeviceRepository, IInstallationDeviceRepository installationDeviceRepository,
INotificationHubPool notificationHubPool, INotificationHubPool notificationHubPool,
IServiceProvider serviceProvider,
IOrganizationUserRepository organizationUserRepository) IOrganizationUserRepository organizationUserRepository)
{ {
_installationDeviceRepository = installationDeviceRepository; _installationDeviceRepository = installationDeviceRepository;
_notificationHubPool = notificationHubPool; _notificationHubPool = notificationHubPool;
_serviceProvider = serviceProvider;
_organizationUserRepository = organizationUserRepository; _organizationUserRepository = organizationUserRepository;
} }

View File

@ -3,12 +3,10 @@ using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations.OrganizationUsers; using Bit.Core.Models.Data.Organizations.OrganizationUsers;
using Bit.Core.NotificationHub; using Bit.Core.NotificationHub;
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.Services;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.AutoFixture.Attributes;
using Microsoft.Azure.NotificationHubs; using Microsoft.Azure.NotificationHubs;
using Microsoft.Extensions.DependencyInjection;
using NSubstitute; using NSubstitute;
using Xunit; using Xunit;
@ -38,16 +36,6 @@ public class NotificationHubPushRegistrationServiceTests
public async void CreateOrUpdateRegistrationAsync_DeviceTypeAndroid_InstallationCreated(bool identifierNull, public async void CreateOrUpdateRegistrationAsync_DeviceTypeAndroid_InstallationCreated(bool identifierNull,
SutProvider<NotificationHubPushRegistrationService> sutProvider, Guid deviceId, Guid userId, Guid? identifier) SutProvider<NotificationHubPushRegistrationService> sutProvider, Guid deviceId, Guid userId, Guid? identifier)
{ {
var featureService = Substitute.For<IFeatureService>();
featureService.IsEnabled(FeatureFlagKeys.AnhFcmv1Migration).Returns(true);
var serviceProvider = Substitute.For<IServiceProvider>();
serviceProvider.GetService(typeof(IFeatureService)).Returns(featureService);
var serviceScope = Substitute.For<IServiceScope>();
serviceScope.ServiceProvider.Returns(serviceProvider);
var serviceScopeFactory = Substitute.For<IServiceScopeFactory>();
serviceScopeFactory.CreateScope().Returns(serviceScope);
sutProvider.GetDependency<IServiceProvider>().GetService(typeof(IServiceScopeFactory))
.Returns(serviceScopeFactory);
var notificationHubClient = Substitute.For<INotificationHubClient>(); var notificationHubClient = Substitute.For<INotificationHubClient>();
sutProvider.GetDependency<INotificationHubPool>().ClientFor(Arg.Any<Guid>()).Returns(notificationHubClient); sutProvider.GetDependency<INotificationHubPool>().ClientFor(Arg.Any<Guid>()).Returns(notificationHubClient);