File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
UserManagementApi.Tests.Unit Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 44using Microsoft . EntityFrameworkCore ;
55using Microsoft . Extensions . Options ;
66using Moq ;
7+ using SharedLibrary . Cache ;
78using UserManagement . Contracts . DTO ;
89using UserManagementApi . Data ;
910using UserManagementApi . DTO ;
@@ -13,6 +14,7 @@ namespace UserManagementApi.Tests.Unit
1314{
1415 public class LoginControllerTests
1516 {
17+ private readonly ICacheAccessProvider _cache ;
1618 private static AppDbContext NewDb ( string name )
1719 {
1820 var opts = new DbContextOptionsBuilder < AppDbContext > ( )
@@ -33,7 +35,7 @@ public async Task Authenticate_WhenMissingUsernameOrPassword_Returns400WithValid
3335 } ;
3436 var wrapped = Options . Create ( jwtOptions ) ; // returns IOptions<JwtOptions>
3537
36- var controller = new TestableLoginController ( db , wrapped ) ;
38+ var controller = new TestableLoginController ( _cache , db , wrapped ) ;
3739
3840 var res = await controller . Authenticate ( new LoginRequest ( "" , "" ) ) ;
3941
Original file line number Diff line number Diff line change 11using Microsoft . Extensions . Options ;
2+ using SharedLibrary . Cache ;
23using UserManagement . Contracts . DTO ;
34using UserManagementApi . Contracts . Models ;
45using UserManagementApi . Controllers ;
@@ -9,13 +10,14 @@ namespace UserManagementApi.Tests.Unit
910{
1011 public sealed class TestableLoginController : UsersController
1112 {
13+ private readonly ICacheAccessProvider _cache ;
1214 private readonly string _jwtToReturn ;
1315 private readonly DateTime _expToReturn ;
1416 private readonly UserPermissionsDto _permToReturn ;
1517
16- public TestableLoginController ( AppDbContext db ,
18+ public TestableLoginController ( ICacheAccessProvider cache , AppDbContext db ,
1719 IOptions < JwtOptions > jwtopts )
18- : base ( db , jwtopts )
20+ : base ( cache , db , jwtopts )
1921 {
2022 _jwtToReturn = "fake-jwt" ;
2123 _expToReturn = DateTime . UtcNow . AddHours ( 1 ) ;
You can’t perform that action at this time.
0 commit comments