399 references to IdentityResultAssert
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (86)
DefaultPocoTest.cs (2)
53
IdentityResultAssert
.IsSuccess(await userManager.CreateAsync(user, password));
54
IdentityResultAssert
.IsSuccess(await userManager.DeleteAsync(user));
SqlStoreOnlyUsersTestBase.cs (8)
109
IdentityResultAssert
.IsSuccess(await userMgr.CreateAsync(user));
110
IdentityResultAssert
.IsSuccess(await userMgr.SetAuthenticationTokenAsync(user, "provider", "test", "value"));
114
IdentityResultAssert
.IsSuccess(await userMgr.DeleteAsync(user));
137
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
138
IdentityResultAssert
.IsSuccess(await manager.DeleteAsync(user));
145
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
146
IdentityResultAssert
.IsSuccess(await manager.AddLoginAsync(user, new UserLoginInfo("provider", user.Id.ToString(), "display")));
154
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, c));
SqlStoreTestBase.cs (20)
164
IdentityResultAssert
.IsSuccess(await roleMgr.CreateAsync(role));
166
IdentityResultAssert
.IsSuccess(await userMgr.CreateAsync(user));
167
IdentityResultAssert
.IsSuccess(await userMgr.AddToRoleAsync(user, roleName));
170
IdentityResultAssert
.IsSuccess(await roleMgr.DeleteAsync(role));
188
IdentityResultAssert
.IsSuccess(await roleMgr.CreateAsync(role));
190
IdentityResultAssert
.IsSuccess(await userMgr.CreateAsync(user));
191
IdentityResultAssert
.IsSuccess(await userMgr.AddToRoleAsync(user, roleName));
196
IdentityResultAssert
.IsSuccess(await userMgr.DeleteAsync(user));
208
IdentityResultAssert
.IsSuccess(await userMgr.CreateAsync(user));
209
IdentityResultAssert
.IsSuccess(await userMgr.SetAuthenticationTokenAsync(user, "provider", "test", "value"));
213
IdentityResultAssert
.IsSuccess(await userMgr.DeleteAsync(user));
236
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
237
IdentityResultAssert
.IsSuccess(await manager.DeleteAsync(user));
247
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
248
IdentityResultAssert
.IsSuccess(await manager.AddLoginAsync(user, new UserLoginInfo("provider", user.Id.ToString(), "display")));
249
IdentityResultAssert
.IsSuccess(await role.CreateAsync(admin));
250
IdentityResultAssert
.IsSuccess(await role.CreateAsync(local));
251
IdentityResultAssert
.IsSuccess(await manager.AddToRoleAsync(user, admin.Name));
252
IdentityResultAssert
.IsSuccess(await manager.AddToRoleAsync(user, local.Name));
260
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, c));
UserOnlyCustomContextTest.cs (2)
98
IdentityResultAssert
.IsSuccess(await userManager.CreateAsync(user, password));
99
IdentityResultAssert
.IsSuccess(await userManager.DeleteAsync(user));
UserOnlyTest.cs (4)
59
IdentityResultAssert
.IsSuccess(await userManager.CreateAsync(user, password));
60
IdentityResultAssert
.IsSuccess(await userManager.DeleteAsync(user));
75
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(userA, password));
78
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(userB, password));
UserStoreEncryptPersonalDataTest.cs (10)
76
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
77
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, "hao@hao.com"));
80
IdentityResultAssert
.IsSuccess(await manager.SetPhoneNumberAsync(user, "123-456-7890"));
82
IdentityResultAssert
.IsSuccess(await manager.AddLoginAsync(user, login));
87
IdentityResultAssert
.IsSuccess(await manager.SetUserNameAsync(user, newName));
88
IdentityResultAssert
.IsSuccess(await manager.UpdateAsync(user));
205
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
213
IdentityResultAssert
.IsSuccess(await manager.UpdateAsync(user));
215
IdentityResultAssert
.IsSuccess(await manager.ResetAuthenticatorKeyAsync(user));
216
IdentityResultAssert
.IsSuccess(await manager.SetAuthenticationTokenAsync(user, "loginProvider", "token", "value"));
UserStoreTest.cs (25)
168
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
169
IdentityResultAssert
.IsSuccess(await manager.DeleteAsync(user));
177
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(userA, "password"));
179
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(userB, "password"));
190
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(userA, "password"));
193
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(userB, "password"));
203
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(u));
218
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
232
IdentityResultAssert
.IsSuccess(await manager1.UpdateAsync(user1));
233
IdentityResultAssert
.IsFailure(await manager2.UpdateAsync(user2), new IdentityErrorDescriber().ConcurrencyFailure());
249
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
261
IdentityResultAssert
.IsSuccess(await manager1.UpdateAsync(user));
262
IdentityResultAssert
.IsFailure(await manager2.UpdateAsync(user2), new IdentityErrorDescriber().ConcurrencyFailure());
278
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
291
IdentityResultAssert
.IsSuccess(await manager1.UpdateAsync(user1));
292
IdentityResultAssert
.IsFailure(await manager2.DeleteAsync(user2), new IdentityErrorDescriber().ConcurrencyFailure());
308
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
322
IdentityResultAssert
.IsSuccess(await manager1.UpdateAsync(role1));
323
IdentityResultAssert
.IsFailure(await manager2.UpdateAsync(role2), new IdentityErrorDescriber().ConcurrencyFailure());
339
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
352
IdentityResultAssert
.IsSuccess(await manager1.UpdateAsync(role));
353
IdentityResultAssert
.IsFailure(await manager2.UpdateAsync(role2), new IdentityErrorDescriber().ConcurrencyFailure());
369
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
382
IdentityResultAssert
.IsSuccess(await manager1.UpdateAsync(role1));
383
IdentityResultAssert
.IsFailure(await manager2.DeleteAsync(role2), new IdentityErrorDescriber().ConcurrencyFailure());
UserStoreWithGenericsTest.cs (15)
101
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
105
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, c));
113
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[0]));
116
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[1]));
119
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[2]));
130
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
131
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user2));
135
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, c));
136
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user2, c));
140
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[0]));
143
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[1]));
146
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[2]));
158
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
159
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, new Claim("c", "a", "i")));
164
IdentityResultAssert
.IsSuccess(await manager.ReplaceClaimAsync(user, oldClaim, claim));
Microsoft.AspNetCore.Identity.InMemory.Test (4)
ControllerTest.cs (4)
51
IdentityResultAssert
.IsSuccess(await userManager.CreateAsync(user, password));
101
IdentityResultAssert
.IsSuccess(await userManager.CreateAsync(user));
102
IdentityResultAssert
.IsSuccess(await userManager.AddLoginAsync(user, new UserLoginInfo(authScheme, externalId, "whatever")));
103
IdentityResultAssert
.IsSuccess(await signInManager.UpdateExternalAuthenticationTokensAsync(externalLogin));
Microsoft.AspNetCore.Identity.Specification.Tests (289)
IdentitySpecificationTestBase.cs (56)
134
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
170
IdentityResultAssert
.IsFailure(await manager.CreateAsync(role),
172
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"Role {await manager.GetRoleIdAsync(role) ?? NullValue} validation failed: {AlwaysBadValidator.ErrorMessage.Code}.");
188
IdentityResultAssert
.IsFailure(result, AlwaysBadValidator.ErrorMessage);
189
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"Role {await manager.GetRoleIdAsync(role) ?? NullValue} validation failed: {AlwaysBadValidator.ErrorMessage.Code};{AlwaysBadValidator.ErrorMessage.Code}.");
202
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
206
IdentityResultAssert
.IsFailure(await manager.UpdateAsync(role), error);
207
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"Role {await manager.GetRoleIdAsync(role) ?? NullValue} validation failed: {AlwaysBadValidator.ErrorMessage.Code}.");
221
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
223
IdentityResultAssert
.IsSuccess(await manager.DeleteAsync(role));
237
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
238
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(roleSafe));
242
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(role, c));
243
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(roleSafe, c));
249
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(role, claims[0]));
254
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(role, claims[1]));
259
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(role, claims[2]));
276
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
292
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
307
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
309
IdentityResultAssert
.IsSuccess(await manager.SetRoleNameAsync(role, "Changed"));
310
IdentityResultAssert
.IsSuccess(await manager.UpdateAsync(role));
328
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(r));
349
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(role));
352
IdentityResultAssert
.IsFailure(await manager.CreateAsync(role2));
367
IdentityResultAssert
.IsSuccess(await roleManager.CreateAsync(role));
374
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(u));
375
IdentityResultAssert
.IsSuccess(await manager.AddToRoleAsync(u, roleName));
394
IdentityResultAssert
.IsSuccess(await userManager.CreateAsync(u));
398
IdentityResultAssert
.IsSuccess(await roleManager.CreateAsync(r));
401
IdentityResultAssert
.IsSuccess(await userManager.AddToRoleAsync(u, await roleManager.GetRoleNameAsync(r)));
429
IdentityResultAssert
.IsSuccess(await userManager.CreateAsync(user));
433
IdentityResultAssert
.IsSuccess(await roleManager.CreateAsync(r));
434
IdentityResultAssert
.IsSuccess(await userManager.AddToRoleAsync(user, await roleManager.GetRoleNameAsync(r)));
437
IdentityResultAssert
.IsSuccess(await userManager.RemoveFromRoleAsync(user, await roleManager.GetRoleNameAsync(roles[2])));
454
IdentityResultAssert
.IsSuccess(await userManager.CreateAsync(u));
458
IdentityResultAssert
.IsSuccess(await roleManager.CreateAsync(r));
461
IdentityResultAssert
.IsSuccess(await userManager.AddToRoleAsync(u, roleName));
466
IdentityResultAssert
.IsSuccess(await userManager.RemoveFromRoleAsync(u, roleName));
484
IdentityResultAssert
.IsSuccess(await userMgr.CreateAsync(user));
485
IdentityResultAssert
.IsSuccess(await roleMgr.CreateAsync(role));
487
IdentityResultAssert
.IsFailure(result, _errorDescriber.UserNotInRole(roleName));
488
IdentityResultAssert
.VerifyLogMessage(userMgr.Logger, $"User is not in role {roleName}.");
504
IdentityResultAssert
.IsSuccess(await userMgr.CreateAsync(user));
505
IdentityResultAssert
.IsSuccess(await roleMgr.CreateAsync(role));
506
IdentityResultAssert
.IsSuccess(await userMgr.AddToRoleAsync(user, roleName));
508
IdentityResultAssert
.IsFailure(await userMgr.AddToRoleAsync(user, roleName), _errorDescriber.UserAlreadyInRole(roleName));
509
IdentityResultAssert
.VerifyLogMessage(userMgr.Logger, $"User is already in role {roleName}.");
525
IdentityResultAssert
.IsSuccess(await userMgr.CreateAsync(user));
526
IdentityResultAssert
.IsSuccess(await roleMgr.CreateAsync(role));
528
IdentityResultAssert
.IsSuccess(await userMgr.AddToRolesAsync(user, new[] { roleName, roleName }));
542
IdentityResultAssert
.IsSuccess(await roleMgr.CreateAsync(role));
556
IdentityResultAssert
.IsSuccess(await roleMgr.CreateAsync(role));
575
IdentityResultAssert
.IsSuccess(await roleManager.CreateAsync(role));
582
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
586
IdentityResultAssert
.IsSuccess(await manager.AddToRolesAsync(user, roleNameList));
UserManagerSpecificationTests.cs (233)
179
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
182
IdentityResultAssert
.IsFailure(await manager.AddPasswordAsync(user, "password"));
194
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
207
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
209
IdentityResultAssert
.IsSuccess(await manager.DeleteAsync(user));
223
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
226
IdentityResultAssert
.IsSuccess(await manager.SetUserNameAsync(user, newName));
227
IdentityResultAssert
.IsSuccess(await manager.UpdateAsync(user));
243
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
245
IdentityResultAssert
.IsSuccess(await manager.SetUserNameAsync(user, newUsername));
250
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(newUser));
252
IdentityResultAssert
.IsFailure(await manager.SetUserNameAsync(newUser, ""), error);
253
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User validation failed: {error.Code}.");
256
IdentityResultAssert
.IsFailure(await manager.SetUserNameAsync(newUser, newUsername), error);
257
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User validation failed: {error.Code}.");
271
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
274
IdentityResultAssert
.IsSuccess(await manager.SetUserNameAsync(user, newUsername));
288
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
290
IdentityResultAssert
.IsSuccess(await manager.ResetAuthenticatorKeyAsync(user));
307
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
308
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, newEmail));
311
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(newUser));
312
IdentityResultAssert
.IsFailure(await manager.SetEmailAsync(newUser, newEmail), _errorDescriber.DuplicateEmail(newEmail));
313
IdentityResultAssert
.IsFailure(await manager.SetEmailAsync(newUser, ""), _errorDescriber.InvalidEmail(""));
325
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, "password"));
330
IdentityResultAssert
.IsSuccess(await manager.UpdateAsync(user));
332
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"Invalid password for user.");
345
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
360
IdentityResultAssert
.IsFailure(await manager.CreateAsync(user), AlwaysBadValidator.ErrorMessage);
361
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User validation failed: {AlwaysBadValidator.ErrorMessage.Code}.");
373
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
376
IdentityResultAssert
.IsFailure(await manager.UpdateAsync(user), AlwaysBadValidator.ErrorMessage);
377
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User validation failed: {AlwaysBadValidator.ErrorMessage.Code}.");
393
IdentityResultAssert
.IsFailure(result, AlwaysBadValidator.ErrorMessage);
394
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User validation failed: {AlwaysBadValidator.ErrorMessage.Code};{AlwaysBadValidator.ErrorMessage.Code}.");
410
IdentityResultAssert
.IsFailure(await manager.CreateAsync(user), _errorDescriber.InvalidEmail(email));
425
IdentityResultAssert
.IsFailure(await manager.CreateAsync(user), _errorDescriber.InvalidEmail(email));
437
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
440
IdentityResultAssert
.IsFailure(await manager.AddPasswordAsync(user, "password"),
442
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User password validation failed: {AlwaysBadValidator.ErrorMessage.Code}.");
457
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
459
IdentityResultAssert
.IsFailure(result, AlwaysBadValidator.ErrorMessage);
472
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, "password"));
475
IdentityResultAssert
.IsFailure(await manager.ChangePasswordAsync(user, "password", "new"));
489
IdentityResultAssert
.IsFailure(await manager.CreateAsync(user, "password"));
505
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, password));
511
IdentityResultAssert
.IsFailure(await manager.ResetPasswordAsync(user, token, newPassword));
525
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, "password"));
528
IdentityResultAssert
.IsFailure(await manager.ChangePasswordAsync(user, "password", "new"),
530
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User password validation failed: {AlwaysBadValidator.ErrorMessage.Code}.");
544
IdentityResultAssert
.IsFailure(await manager.CreateAsync(user, "password"), AlwaysBadValidator.ErrorMessage);
545
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User password validation failed: {AlwaysBadValidator.ErrorMessage.Code}.");
557
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(CreateTestUser(username, useNamePrefixAsUserName: true)));
578
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
580
IdentityResultAssert
.IsSuccess(await manager.AddLoginAsync(user, new UserLoginInfo(provider, providerKey, display)));
598
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
601
IdentityResultAssert
.IsSuccess(await manager.AddLoginAsync(user, login));
603
IdentityResultAssert
.IsSuccess(await manager.AddPasswordAsync(user, "password"));
621
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, "Password"));
623
IdentityResultAssert
.IsFailure(await manager.AddPasswordAsync(user, "password"),
625
IdentityResultAssert
.VerifyLogMessage(manager.Logger, "User already has a password.");
641
IdentityResultAssert
.IsSuccess(result);
642
IdentityResultAssert
.IsSuccess(await manager.AddLoginAsync(user, login));
651
IdentityResultAssert
.IsSuccess(await manager.RemoveLoginAsync(user, login.LoginProvider, login.ProviderKey));
669
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, password));
672
IdentityResultAssert
.IsSuccess(await manager.RemovePasswordAsync(user));
690
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, password));
693
IdentityResultAssert
.IsSuccess(await manager.ChangePasswordAsync(user, password, newPassword));
708
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
712
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, c));
717
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[0]));
720
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[1]));
723
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[2]));
738
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
739
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user2));
743
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, c));
744
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user2, c));
748
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[0]));
751
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[1]));
754
IdentityResultAssert
.IsSuccess(await manager.RemoveClaimAsync(user, claims[2]));
770
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
771
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, new Claim("c", "a")));
776
IdentityResultAssert
.IsSuccess(await manager.ReplaceClaimAsync(user, oldClaim, claim));
794
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
795
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user2));
796
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, new Claim("c", "a")));
797
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user2, new Claim("c", "a")));
804
IdentityResultAssert
.IsSuccess(await manager.ReplaceClaimAsync(user, oldClaim, claim));
826
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, "password"));
828
IdentityResultAssert
.IsFailure(result, "Incorrect password.");
829
IdentityResultAssert
.VerifyLogMessage(manager.Logger, "Change password failed for user.");
843
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
844
IdentityResultAssert
.IsFailure(await manager.CreateAsync(user2), _errorDescriber.DuplicateUserName(username));
857
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
858
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user2));
859
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user2, await manager.GetEmailAsync(user)));
873
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
874
IdentityResultAssert
.IsFailure(await manager.CreateAsync(user2), _errorDescriber.DuplicateEmail("FooUser@yup.com"));
886
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
888
IdentityResultAssert
.IsSuccess(await manager.UpdateSecurityStampAsync(user));
902
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
903
IdentityResultAssert
.IsSuccess(await manager.AddLoginAsync(user, login));
905
IdentityResultAssert
.IsFailure(result, _errorDescriber.LoginAlreadyAssociated());
906
IdentityResultAssert
.VerifyLogMessage(manager.Logger, "AddLogin for user failed because it was already associated with another user.");
921
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
939
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(u));
955
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
995
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, password));
1001
IdentityResultAssert
.IsSuccess(await manager.ResetPasswordAsync(user, token, newPassword));
1020
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, password));
1026
IdentityResultAssert
.IsFailure(await manager.ResetPasswordAsync(user, token, newPassword),
1028
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"User password validation failed: {AlwaysBadValidator.ErrorMessage.Code}.");
1046
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, password));
1049
IdentityResultAssert
.IsFailure(await manager.ResetPasswordAsync(user, "bogus", newPassword), "Invalid token.");
1050
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: ResetPassword for user.");
1066
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1067
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user2));
1074
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: test2 for user.");
1077
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: test for user.");
1080
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: test for user.");
1095
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1099
IdentityResultAssert
.IsSuccess(await manager.ConfirmEmailAsync(user, token));
1101
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, null));
1117
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1118
IdentityResultAssert
.IsFailure(await manager.ConfirmEmailAsync(user, "bogus"), "Invalid token.");
1120
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: EmailConfirmation for user.");
1133
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user, "password"));
1136
IdentityResultAssert
.IsSuccess(await manager.ChangePasswordAsync(user, "password", "newpassword"));
1137
IdentityResultAssert
.IsFailure(await manager.ConfirmEmailAsync(user, token), "Invalid token.");
1138
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: EmailConfirmation for user.");
1155
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1158
IdentityResultAssert
.IsSuccess(await mgr.AccessFailedAsync(user));
1161
IdentityResultAssert
.VerifyLogMessage(mgr.Logger, $"User is locked out.");
1177
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1180
IdentityResultAssert
.IsSuccess(await mgr.AccessFailedAsync(user));
1184
IdentityResultAssert
.IsSuccess(await mgr.AccessFailedAsync(user));
1187
IdentityResultAssert
.VerifyLogMessage(mgr.Logger, $"User is locked out.");
1202
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1205
IdentityResultAssert
.IsSuccess(await mgr.AccessFailedAsync(user));
1209
IdentityResultAssert
.IsSuccess(await mgr.ResetAccessFailedCountAsync(user));
1213
IdentityResultAssert
.IsSuccess(await mgr.AccessFailedAsync(user));
1231
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1233
IdentityResultAssert
.IsSuccess(await mgr.SetLockoutEnabledAsync(user, true));
1236
IdentityResultAssert
.IsSuccess(await mgr.AccessFailedAsync(user));
1240
IdentityResultAssert
.IsSuccess(await mgr.AccessFailedAsync(user));
1243
IdentityResultAssert
.VerifyLogMessage(mgr.Logger, $"User is locked out.");
1256
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1258
IdentityResultAssert
.IsSuccess(await mgr.SetLockoutEndDateAsync(user, new DateTimeOffset()));
1273
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1275
IdentityResultAssert
.IsFailure(await mgr.SetLockoutEndDateAsync(user, new DateTimeOffset()),
1277
IdentityResultAssert
.VerifyLogMessage(mgr.Logger, $"Lockout for user failed because lockout is not enabled for this user.");
1290
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1304
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1306
IdentityResultAssert
.IsSuccess(await mgr.SetLockoutEndDateAsync(user, DateTimeOffset.UtcNow.AddSeconds(-1)));
1320
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1334
IdentityResultAssert
.IsSuccess(await mgr.CreateAsync(user));
1337
IdentityResultAssert
.IsSuccess(await mgr.SetLockoutEndDateAsync(user, lockoutEnd));
1352
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1355
IdentityResultAssert
.IsSuccess(await manager.SetPhoneNumberAsync(user, "111-111-1111"));
1369
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1373
IdentityResultAssert
.IsSuccess(await manager.ChangePhoneNumberAsync(user, "111-111-1111", token1));
1388
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1402
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1405
IdentityResultAssert
.IsFailure(await manager.ChangePhoneNumberAsync(user, "111-111-1111", "bogus"),
1407
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: ChangePhoneNumber:111-111-1111 for user.");
1436
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1439
IdentityResultAssert
.IsSuccess(await manager.ChangePhoneNumberAsync(user, "111-111-1111", "whatever"));
1454
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1458
IdentityResultAssert
.IsFailure(await manager.ChangePhoneNumberAsync(user, "bogus", token1),
1474
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1486
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: ChangePhoneNumber:{num1} for user.");
1487
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: ChangePhoneNumber:{num2} for user.");
1499
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1501
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, email));
1506
IdentityResultAssert
.IsSuccess(await manager.ChangeEmailAsync(user, newEmail, token1));
1521
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1523
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, email));
1529
IdentityResultAssert
.IsSuccess(await manager.ChangeEmailAsync(user, newEmail, token1));
1533
IdentityResultAssert
.IsFailure(await manager.ChangeEmailAsync(user, "should@fail.com", token2));
1548
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1550
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, email));
1555
IdentityResultAssert
.IsSuccess(await manager.ChangeEmailAsync(user, newEmail, token1));
1570
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1572
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, email));
1577
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, "another@email.com"));
1579
IdentityResultAssert
.IsFailure(await manager.ChangeEmailAsync(user, newEmail, token1));
1593
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1595
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, email));
1599
IdentityResultAssert
.IsFailure(await manager.ChangeEmailAsync(user, "whatevah@foo.boop", "bogus"),
1601
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: ChangeEmail:whatevah@foo.boop for user.");
1616
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1618
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, email));
1623
IdentityResultAssert
.IsFailure(await manager.ChangeEmailAsync(user, "oops@foo.boop", token1),
1625
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyUserTokenAsync() failed with purpose: ChangeEmail:oops@foo.boop for user.");
1641
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1643
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, email));
1645
IdentityResultAssert
.IsSuccess(await manager.ConfirmEmailAsync(user, token));
1651
IdentityResultAssert
.IsSuccess(await manager.UpdateSecurityStampAsync(user));
1655
IdentityResultAssert
.IsSuccess(await manager.UpdateSecurityStampAsync(user));
1658
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyTwoFactorTokenAsync() failed for user.");
1670
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1673
IdentityResultAssert
.IsSuccess(await manager.SetTwoFactorEnabledAsync(user, true));
1687
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1712
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1727
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1729
IdentityResultAssert
.IsSuccess(await manager.SetAuthenticationTokenAsync(user, "provider", "name", "value"));
1732
IdentityResultAssert
.IsSuccess(await manager.SetAuthenticationTokenAsync(user, "provider", "name", "value2"));
1735
IdentityResultAssert
.IsSuccess(await manager.RemoveAuthenticationTokenAsync(user, "whatevs", "name"));
1738
IdentityResultAssert
.IsSuccess(await manager.RemoveAuthenticationTokenAsync(user, "provider", "name"));
1751
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1759
IdentityResultAssert
.IsSuccess(await manager.RedeemTwoFactorRecoveryCodeAsync(user, code));
1760
IdentityResultAssert
.IsFailure(await manager.RedeemTwoFactorRecoveryCodeAsync(user, code));
1766
IdentityResultAssert
.IsFailure(await manager.RedeemTwoFactorRecoveryCodeAsync(user, code));
1779
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1789
IdentityResultAssert
.IsFailure(await manager.RedeemTwoFactorRecoveryCodeAsync(user, code));
1794
IdentityResultAssert
.IsSuccess(await manager.RedeemTwoFactorRecoveryCodeAsync(user, code));
1807
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1812
IdentityResultAssert
.IsSuccess(await manager.SetPhoneNumberAsync(user, "111-111-1111"));
1814
IdentityResultAssert
.IsSuccess(await manager.ChangePhoneNumberAsync(user, "111-111-1111", token));
1820
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, "test@test.com"));
1822
IdentityResultAssert
.IsSuccess(await manager.ConfirmEmailAsync(user, token));
1826
IdentityResultAssert
.IsSuccess(await manager.SetEmailAsync(user, null));
1831
IdentityResultAssert
.IsSuccess(await manager.ResetAuthenticatorKeyAsync(user));
1848
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1853
IdentityResultAssert
.IsSuccess(await manager.UpdateSecurityStampAsync(user));
1855
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyTwoFactorTokenAsync() failed for user.");
1867
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1871
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyTwoFactorTokenAsync() failed for user.");
1883
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1885
IdentityResultAssert
.VerifyLogMessage(manager.Logger, $"VerifyTwoFactorTokenAsync() failed for user.");
1897
IdentityResultAssert
.IsSuccess(await userMgr.CreateAsync(user));
1923
IdentityResultAssert
.IsSuccess(await manager.CreateAsync(user));
1927
IdentityResultAssert
.IsSuccess(await manager.AddClaimAsync(user, new Claim("foo", "bar")));
Microsoft.AspNetCore.Identity.Test (20)
PasswordValidatorTest.cs (8)
44
IdentityResultAssert
.IsFailure(await valid.ValidateAsync(manager, null, input), error);
58
IdentityResultAssert
.IsSuccess(await valid.ValidateAsync(manager, null, input));
73
IdentityResultAssert
.IsFailure(await valid.ValidateAsync(manager, null, input),
90
IdentityResultAssert
.IsSuccess(await valid.ValidateAsync(manager, null, input));
107
IdentityResultAssert
.IsFailure(await valid.ValidateAsync(manager, null, input),
128
IdentityResultAssert
.IsSuccess(await valid.ValidateAsync(manager, null, input));
171
IdentityResultAssert
.IsSuccess(result);
175
IdentityResultAssert
.IsFailure(result);
RoleValidatorTest.cs (1)
35
IdentityResultAssert
.IsFailure(result, new IdentityErrorDescriber().InvalidRoleName(input));
UserManagerTest.cs (6)
432
IdentityResultAssert
.IsFailure(result, new IdentityErrorDescriber().UserAlreadyInRole("B"));
496
IdentityResultAssert
.IsFailure(result, new IdentityErrorDescriber().UserNotInRole("B"));
988
IdentityResultAssert
.IsFailure(await manager.CreateAsync(new PocoUser(), "password"),
998
IdentityResultAssert
.IsFailure(await manager.CreateAsync(new PocoUser(), "password"));
1012
IdentityResultAssert
.IsSuccess(await manager.ResetAccessFailedCountAsync(user));
1773
IdentityResultAssert
.IsFailure(await manager.CreateAsync(user), describer.DuplicateEmail(user.Email));
UserValidatorTest.cs (5)
35
IdentityResultAssert
.IsFailure(result, new IdentityErrorDescriber().InvalidUserName(input));
59
IdentityResultAssert
.IsSuccess(result);
63
IdentityResultAssert
.IsFailure(result);
87
IdentityResultAssert
.IsSuccess(result);
91
IdentityResultAssert
.IsFailure(result);