File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,8 @@ public Task<bool> GetLockoutEnabledAsync(TUser user)
256
256
257
257
public Task SetLockoutEnabledAsync ( TUser user , bool enabled )
258
258
{
259
- throw new NotImplementedException ( ) ;
259
+ user . LockoutEnabled = enabled ;
260
+ return Task . FromResult ( 0 ) ;
260
261
}
261
262
}
262
263
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public void AccessFailed_IncrementsAccessFailedCount()
25
25
public void IncrementAccessFailedCount_ReturnsNewCount ( )
26
26
{
27
27
var store = new UserStore < IdentityUser > ( null ) ;
28
- var user = new IdentityUser { UserName = "bob" } ;
28
+ var user = new IdentityUser { UserName = "bob" } ;
29
29
30
30
var count = store . IncrementAccessFailedCountAsync ( user ) ;
31
31
@@ -73,5 +73,19 @@ public void AccessFailed_ExceedsMaxFailedAccessAttempts_LocksAccount()
73
73
var lockoutEndDate = manager . GetLockoutEndDate ( user . Id ) ;
74
74
Expect ( lockoutEndDate . Subtract ( DateTime . UtcNow ) . TotalHours , Is . GreaterThan ( 0.9 ) . And . LessThan ( 1.1 ) ) ;
75
75
}
76
+
77
+ [ Test ]
78
+ public void SetLockoutEnabled ( )
79
+ {
80
+ var manager = GetUserManager ( ) ;
81
+ var user = new IdentityUser { UserName = "bob" } ;
82
+ manager . Create ( user ) ;
83
+
84
+ manager . SetLockoutEnabled ( user . Id , true ) ;
85
+ Expect ( manager . GetLockoutEnabled ( user . Id ) ) ;
86
+
87
+ manager . SetLockoutEnabled ( user . Id , false ) ;
88
+ Expect ( manager . GetLockoutEnabled ( user . Id ) , Is . False ) ;
89
+ }
76
90
}
77
91
}
You can’t perform that action at this time.
0 commit comments