8 instantiations of PocoRole
Microsoft.AspNetCore.Identity.Test (8)
RoleManagerTest.cs (5)
16
var role = new
PocoRole
{ Name = "Foo" };
36
var role = new
PocoRole
{ Name = "Foo" };
64
var role = new
PocoRole
{ Name = "Foo" };
81
var role = new
PocoRole
{ Name = "Foo" };
100
var role = new
PocoRole
{ Name = "Foo" };
RoleValidatorTest.cs (1)
29
var user = new
PocoRole
{ Name = input };
UserClaimsPrincipalFactoryTest.cs (2)
68
var admin = new
PocoRole
() { Name = "Admin" };
69
var local = new
PocoRole
() { Name = "Local" };
124 references to PocoRole
Microsoft.AspNetCore.Identity.Test (124)
IdentityBuilderTest.cs (53)
18
.AddRoles<
PocoRole
>()
22
Assert.NotNull(sp.GetRequiredService<IRoleValidator<
PocoRole
>>());
23
Assert.IsType<NoopRoleStore>(sp.GetRequiredService<IRoleStore<
PocoRole
>>());
24
Assert.IsType<RoleManager<
PocoRole
>>(sp.GetRequiredService<RoleManager<
PocoRole
>>());
25
Assert.NotNull(sp.GetRequiredService<RoleManager<
PocoRole
>>());
26
Assert.IsType<UserClaimsPrincipalFactory<PocoUser,
PocoRole
>>(sp.GetRequiredService<IUserClaimsPrincipalFactory<PocoUser>>());
46
.AddRoles<
PocoRole
>();
48
Assert.NotNull(sp.GetRequiredService<IRoleValidator<
PocoRole
>>());
49
Assert.Null(sp.GetService<IRoleStore<
PocoRole
>>());
50
Assert.Throws<InvalidOperationException>(() => sp.GetService<RoleManager<
PocoRole
>>());
58
services.AddIdentity<PocoUser,
PocoRole
>().AddUserStore<MyUberThingy>();
68
services.AddIdentity<PocoUser,
PocoRole
>().AddRoleStore<MyUberThingy>();
69
var thingy = services.BuildServiceProvider().GetRequiredService<IRoleStore<
PocoRole
>>() as MyUberThingy;
79
services.AddIdentity<PocoUser,
PocoRole
>()
94
services.AddIdentity<PocoUser,
PocoRole
>()
109
services.AddIdentity<PocoUser,
PocoRole
>().AddRoleValidator<MyUberThingy>();
110
var thingy = services.BuildServiceProvider().GetRequiredService<IRoleValidator<
PocoRole
>>() as MyUberThingy;
119
services.AddIdentity<PocoUser,
PocoRole
>().AddUserValidator<MyUberThingy>();
129
services.AddIdentity<PocoUser,
PocoRole
>().AddPasswordValidator<MyUberThingy>();
139
services.AddIdentity<PocoUser,
PocoRole
>()
151
services.AddIdentity<PocoUser,
PocoRole
>()
154
var myRoleManager = services.BuildServiceProvider().GetRequiredService<RoleManager<
PocoRole
>>() as MyRoleManager;
165
services.AddIdentity<PocoUser,
PocoRole
>()
181
.AddIdentity<PocoUser,
PocoRole
>()
195
Assert.IsType<RoleManager<
PocoRole
>>(provider.GetRequiredService<RoleManager<
PocoRole
>>());
205
.AddIdentity<PocoUser,
PocoRole
>()
225
.AddRoles<
PocoRole
>()
243
services.AddIdentity<PocoUser,
PocoRole
>().AddDefaultTokenProviders();
255
var builder = services.AddIdentity<PocoUser,
PocoRole
>();
266
var builder = services.AddIdentity<PocoUser,
PocoRole
>();
271
private class MyUberThingy : IUserValidator<PocoUser>, IPasswordValidator<PocoUser>, IRoleValidator<
PocoRole
>, IUserStore<PocoUser>, IRoleStore<
PocoRole
>
273
public Task<IdentityResult> CreateAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
283
public Task<IdentityResult> DeleteAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
308
public Task<string> GetNormalizedRoleNameAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
318
public Task<string> GetRoleIdAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
323
public Task<string> GetRoleNameAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
338
public Task SetNormalizedRoleNameAsync(
PocoRole
role, string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
348
public Task SetRoleNameAsync(
PocoRole
role, string roleName, CancellationToken cancellationToken = default(CancellationToken))
358
public Task<IdentityResult> UpdateAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
368
public Task<IdentityResult> ValidateAsync(RoleManager<
PocoRole
> manager,
PocoRole
role)
383
Task<
PocoRole
> IRoleStore<
PocoRole
>.FindByIdAsync(string roleId, CancellationToken cancellationToken)
388
Task<
PocoRole
> IRoleStore<
PocoRole
>.FindByNameAsync(string roleName, CancellationToken cancellationToken)
404
private class MyClaimsPrincipalFactory : UserClaimsPrincipalFactory<PocoUser,
PocoRole
>
406
public MyClaimsPrincipalFactory(UserManager<PocoUser> userManager, RoleManager<
PocoRole
> roleManager, IOptions<IdentityOptions> optionsAccessor) : base(userManager, roleManager, optionsAccessor)
411
private class MyRoleManager : RoleManager<
PocoRole
>
413
public MyRoleManager(IRoleStore<
PocoRole
> store,
414
IEnumerable<IRoleValidator<
PocoRole
>> roleValidators) : base(store, null, null, null, null)
IdentityOptionsTest.cs (2)
41
services.AddIdentity<PocoUser,
PocoRole
>();
61
services.AddIdentity<PocoUser,
PocoRole
>(options => options.User.RequireUniqueEmail = true);
NoopRoleStore.cs (13)
6
public class NoopRoleStore : IRoleStore<
PocoRole
>
8
public Task<IdentityResult> CreateAsync(
PocoRole
user, CancellationToken cancellationToken = default(CancellationToken))
13
public Task<IdentityResult> UpdateAsync(
PocoRole
user, CancellationToken cancellationToken = default(CancellationToken))
18
public Task<string> GetRoleNameAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
23
public Task SetRoleNameAsync(
PocoRole
role, string roleName, CancellationToken cancellationToken = default(CancellationToken))
28
public Task<
PocoRole
> FindByIdAsync(string roleId, CancellationToken cancellationToken = default(CancellationToken))
30
return Task.FromResult<
PocoRole
>(null);
33
public Task<
PocoRole
> FindByNameAsync(string userName, CancellationToken cancellationToken = default(CancellationToken))
35
return Task.FromResult<
PocoRole
>(null);
42
public Task<IdentityResult> DeleteAsync(
PocoRole
user, CancellationToken cancellationToken = default(CancellationToken))
47
public Task<string> GetRoleIdAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
52
public Task<string> GetNormalizedRoleNameAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
57
public Task SetNormalizedRoleNameAsync(
PocoRole
role, string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
RoleManagerTest.cs (26)
15
var store = new Mock<IRoleStore<
PocoRole
>>();
16
var
role = new PocoRole { Name = "Foo" };
35
var store = new Mock<IRoleStore<
PocoRole
>>();
36
var
role = new PocoRole { Name = "Foo" };
63
var store = new Mock<IRoleStore<
PocoRole
>>();
64
var
role = new PocoRole { Name = "Foo" };
69
var
result = await manager.FindByNameAsync(role.Name);
80
var store = new Mock<IRoleStore<
PocoRole
>>();
81
var
role = new PocoRole { Name = "Foo" };
87
var
result = await manager.FindByNameAsync(role.Name);
99
var store = new Mock<IRoleStore<
PocoRole
>>();
100
var
role = new PocoRole { Name = "Foo" };
124
() => new RoleManager<
PocoRole
>(null, null, null, null, null));
146
private static RoleManager<
PocoRole
> CreateRoleManager(IRoleStore<
PocoRole
> roleStore)
151
private class NotImplementedStore : IRoleStore<
PocoRole
>
153
public Task<IdentityResult> CreateAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
158
public Task<IdentityResult> UpdateAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
163
public Task<IdentityResult> DeleteAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
168
public Task<string> GetRoleIdAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
173
public Task<string> GetRoleNameAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
178
public Task SetRoleNameAsync(
PocoRole
role, string roleName, CancellationToken cancellationToken = default(CancellationToken))
183
public Task<
PocoRole
> FindByIdAsync(string roleId, CancellationToken cancellationToken = default(CancellationToken))
188
public Task<
PocoRole
> FindByNameAsync(string roleName, CancellationToken cancellationToken = default(CancellationToken))
198
public Task<string> GetNormalizedRoleNameAsync(
PocoRole
role, CancellationToken cancellationToken = default(CancellationToken))
203
public Task SetNormalizedRoleNameAsync(
PocoRole
role, string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
RoleValidatorTest.cs (5)
12
var validator = new RoleValidator<
PocoRole
>();
13
var manager = MockHelpers.TestRoleManager<
PocoRole
>();
27
var validator = new RoleValidator<
PocoRole
>();
28
var manager = MockHelpers.TestRoleManager<
PocoRole
>();
29
var
user = new PocoRole { Name = input };
SignInManagerTest.cs (8)
42
var roleManager = MockHelpers.MockRoleManager<
PocoRole
>();
46
var claimsFactory = new UserClaimsPrincipalFactory<PocoUser,
PocoRole
>(manager.Object, roleManager.Object, options.Object);
72
var roleManager = MockHelpers.MockRoleManager<
PocoRole
>();
76
var claimsFactory = new UserClaimsPrincipalFactory<PocoUser,
PocoRole
>(manager.Object, roleManager.Object, options.Object);
104
var roleManager = MockHelpers.MockRoleManager<
PocoRole
>();
108
var claimsFactory = new UserClaimsPrincipalFactory<PocoUser,
PocoRole
>(manager, roleManager.Object, options.Object);
1283
var roleManager = MockHelpers.MockRoleManager<
PocoRole
>();
1285
var claimsFactory = new UserClaimsPrincipalFactory<PocoUser,
PocoRole
>(manager, roleManager.Object, options);
UserClaimsPrincipalFactoryTest.cs (7)
16
var roleManager = MockHelpers.MockRoleManager<
PocoRole
>().Object;
19
() => new UserClaimsPrincipalFactory<PocoUser,
PocoRole
>(userManager, roleManager, options.Object));
22
var factory = new UserClaimsPrincipalFactory<PocoUser,
PocoRole
>(userManager, roleManager, options.Object);
44
var roleManager = MockHelpers.MockRoleManager<
PocoRole
>();
68
var
admin = new PocoRole() { Name = "Admin" };
69
var
local = new PocoRole() { Name = "Local" };
83
var factory = new UserClaimsPrincipalFactory<PocoUser,
PocoRole
>(userManager.Object, roleManager.Object, options.Object);
UserManagerTest.cs (10)
21
services.AddIdentity<PocoUser,
PocoRole
>();
40
services.AddIdentity<PocoUser,
PocoRole
>()
46
Assert.Same(provider.GetRequiredService<RoleManager<
PocoRole
>>(),
56
public class CustomRoleManager : RoleManager<
PocoRole
>
58
public CustomRoleManager() : base(new Mock<IRoleStore<
PocoRole
>>().Object, null, null, null, null)
796
services.AddIdentity<PocoUser,
PocoRole
>(o => o.Tokens.ProviderMap.Add("A", new TokenProviderDescriptor(typeof(ATokenProvider))
809
services.AddIdentity<PocoUser,
PocoRole
>(o => o.Stores.ProtectPersonalData = true)
820
services.AddIdentity<PocoUser,
PocoRole
>(o => o.Stores.ProtectPersonalData = true)
893
services.AddIdentity<PocoUser,
PocoRole
>(o => o.Tokens.ProviderMap.Add(TokenOptions.DefaultProvider, new TokenProviderDescriptor(typeof(ATokenProvider))
1752
services.AddIdentity<PocoUser,
PocoRole
>();