Exemplo n.º 1
0
 public void NullServices_Throws()
 {
     Assert.Throws <ArgumentNullException>("services", () =>
     {
         IdentityServices.AddUserEmailStore <User, FakeUserEmailStore>(
             services: null);
     });
 }
Exemplo n.º 2
0
                public void WhenCalled_AddsRetrieveOperation()
                {
                    var services = new ServiceCollection();

                    IdentityServices.AddUserEmailStore <User, FakeUserEmailStore>(services);

                    var provider = services.BuildServiceProvider();

                    Assert.NotNull(provider.GetRequiredService <IRetrieveOperation <EmailAddress, User> >());
                }
Exemplo n.º 3
0
                public void WhenCalled_AddsIUserHelper()
                {
                    var services = Services();

                    IdentityServices.AddInfrastructure(services);
                    IdentityServices.AddPasswords(services);
                    IdentityServices.AddUserEmailStore <User, FakeUserEmailStore>(services);
                    IdentityServices.AddSingleUseTokenService <FakeSingleUseTokenService>(
                        services);
                    IdentityServices.AddTimedLockoutStore <FakeTimedLockoutStore>(services);

                    // Act
                    IdentityServices.AddUserHelpers <User>(services);

                    var provider = services.BuildServiceProvider();

                    Assert.NotNull(provider.GetRequiredService <IUserHelper>());
                    Assert.True(provider.GetRequiredService <IUserHelper>() is UserHelper <User>);
                }
Exemplo n.º 4
0
                public void NotNullServices_AddsIIdentityService()
                {
                    var services = new ServiceCollection();

                    IdentityServices.AddOptions(services, new IdentityOptions());
                    IdentityServices.AddInfrastructure(services);
                    IdentityServices.AddPasswords(services);
                    IdentityServices.AddUserHelpers <User>(services);
                    IdentityServices.AddUserValidators <User>(services, new UserOptions());
                    IdentityServices.AddSingleUseTokenService <FakeSingleUseTokenService>(
                        services);
                    IdentityServices.AddTimedLockoutStore <FakeTimedLockoutStore>(services);
                    IdentityServices.AddUserEmailStore <User, FakeUserEmailStore>(services);
                    IdentityServices.AddUserStore <User, FakeUserStore>(services);
                    IdentityServices.AddUserClaims <User>(services);

                    // Act
                    IdentityServices.AddIdentityServices <User>(services);

                    var provider = services.BuildServiceProvider();

                    Assert.NotNull(provider.GetRequiredService <IIdentityService <User> >());
                    Assert.True(provider.GetRequiredService <IIdentityService <User> >() is IdentityService <User>);
                }