Skip to content

Commit 2bf2413

Browse files
committed
Updating tests to have substitutes for userService and userManger.
1 parent 6466349 commit 2bf2413

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Integration.Test/BackendConfigurationAssignmentWorkerServiceHelperTest.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
using BackendConfiguration.Pn.Infrastructure.Models.Properties;
55
using BackendConfiguration.Pn.Services.BackendConfigurationLocalizationService;
66
using eFormCore;
7+
using Microsoft.AspNetCore.Identity;
78
using Microsoft.EntityFrameworkCore;
89
using Microsoft.Extensions.Logging;
910
using Microting.eForm.Infrastructure.Constants;
1011
using Microting.eFormApi.BasePn.Abstractions;
12+
using Microting.eFormApi.BasePn.Infrastructure.Database.Entities;
1113
using NSubstitute;
1214

1315
namespace BackendConfiguration.Pn.Integration.Test;
@@ -178,7 +180,12 @@ await BackendConfigurationAssignmentWorkerServiceHelper.CreateDeviceUser(deviceU
178180
};
179181

180182
// Act
183+
var userService = Substitute.For<IUserService>();
184+
var userManager = Substitute.For<UserManager<EformUser>>(
185+
Substitute.For<IUserStore<EformUser>>(),
186+
null, null, null, null, null, null, null, null);
181187
var result = await BackendConfigurationAssignmentWorkerServiceHelper.UpdateDeviceUser(newDeviceUserModel, core, 1,
188+
userService, userManager,
182189
BackendConfigurationPnDbContext,
183190
TimePlanningPnDbContext, logger, ItemsPlanningPnDbContext);
184191

@@ -270,8 +277,14 @@ await BackendConfigurationAssignmentWorkerServiceHelper.CreateDeviceUser(deviceU
270277
};
271278

272279
// Act
280+
var userService = Substitute.For<IUserService>();
281+
var userManager = Substitute.For<UserManager<EformUser>>(
282+
Substitute.For<IUserStore<EformUser>>(),
283+
null, null, null, null, null, null, null, null);
273284
var result = await BackendConfigurationAssignmentWorkerServiceHelper.UpdateDeviceUser(newDeviceUserModel, core,
274285
1,
286+
userService,
287+
userManager,
275288
BackendConfigurationPnDbContext,
276289
TimePlanningPnDbContext, logger, ItemsPlanningPnDbContext);
277290

@@ -364,8 +377,14 @@ await BackendConfigurationAssignmentWorkerServiceHelper.CreateDeviceUser(deviceU
364377
};
365378

366379
// Act
380+
var userService = Substitute.For<IUserService>();
381+
var userManager = Substitute.For<UserManager<EformUser>>(
382+
Substitute.For<IUserStore<EformUser>>(),
383+
null, null, null, null, null, null, null, null);
367384
var result = await BackendConfigurationAssignmentWorkerServiceHelper.UpdateDeviceUser(newDeviceUserModel, core,
368385
1,
386+
userService,
387+
userManager,
369388
BackendConfigurationPnDbContext,
370389
TimePlanningPnDbContext, logger, ItemsPlanningPnDbContext);
371390

0 commit comments

Comments
 (0)