Exemple #1
0
        public void UserStorePublicNullCheckTest()
        {
            var store = new UserStore <IdentityUser>();

            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.CreateAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.UpdateAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.DeleteAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.AddClaimAsync(null, null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.RemoveClaimAsync(null, null)),
                                               "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetClaimsAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetLoginsAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetRolesAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.AddLoginAsync(null, null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.RemoveLoginAsync(null, null)),
                                               "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.AddToRoleAsync(null, null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.RemoveFromRoleAsync(null, null)),
                                               "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.IsInRoleAsync(null, null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetPasswordHashAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.SetPasswordHashAsync(null, null)),
                                               "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetSecurityStampAsync(null)),
                                               "user");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.SetSecurityStampAsync(null, null)), "user");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.AddClaimAsync(new IdentityUser("fake"), null)), "claim");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.RemoveClaimAsync(new IdentityUser("fake"), null)), "claim");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.AddLoginAsync(new IdentityUser("fake"), null)), "login");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.RemoveLoginAsync(new IdentityUser("fake"), null)), "login");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.FindAsync(null)), "login");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetEmailConfirmedAsync(null)),
                                               "user");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.SetEmailConfirmedAsync(null, true)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetEmailAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.SetEmailAsync(null, null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetPhoneNumberAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.SetPhoneNumberAsync(null, null)),
                                               "user");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.GetPhoneNumberConfirmedAsync(null)), "user");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.SetPhoneNumberConfirmedAsync(null, true)), "user");
            ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetTwoFactorEnabledAsync(null)),
                                               "user");
            ExceptionHelper.ThrowsArgumentNull(
                () => AsyncHelper.RunSync(() => store.SetTwoFactorEnabledAsync(null, true)), "user");
            ExceptionHelper.ThrowsArgumentNullOrEmpty(
                () => AsyncHelper.RunSync(() => store.AddToRoleAsync(new IdentityUser("fake"), null)), "roleName");
            ExceptionHelper.ThrowsArgumentNullOrEmpty(
                () => AsyncHelper.RunSync(() => store.RemoveFromRoleAsync(new IdentityUser("fake"), null)), "roleName");
            ExceptionHelper.ThrowsArgumentNullOrEmpty(
                () => AsyncHelper.RunSync(() => store.IsInRoleAsync(new IdentityUser("fake"), null)), "roleName");
        }
 public async Task AddRemoveUserClaimTest()
 {
     var db = UnitTestHelper.CreateDefaultDb();
     var store = new UserStore<IdentityUser>(db);
     ;
     var user = new IdentityUser("ClaimsAddRemove");
     await store.CreateAsync(user);
     Claim[] claims = {new Claim("c", "v"), new Claim("c2", "v2"), new Claim("c2", "v3")};
     foreach (Claim c in claims)
     {
         await store.AddClaimAsync(user, c);
     }
     await store.UpdateAsync(user);
     var userClaims = await store.GetClaimsAsync(user);
     Assert.Equal(3, userClaims.Count);
     await store.RemoveClaimAsync(user, claims[0]);
     Assert.Equal(3, userClaims.Count); // No effect until save changes
     db.SaveChanges();
     userClaims = await store.GetClaimsAsync(user);
     Assert.Equal(2, userClaims.Count);
     await store.RemoveClaimAsync(user, claims[1]);
     Assert.Equal(2, userClaims.Count); // No effect until save changes
     db.SaveChanges();
     userClaims = await store.GetClaimsAsync(user);
     Assert.Equal(1, userClaims.Count);
     await store.RemoveClaimAsync(user, claims[2]);
     Assert.Equal(1, userClaims.Count); // No effect until save changes
     db.SaveChanges();
     userClaims = await store.GetClaimsAsync(user);
     Assert.Equal(0, userClaims.Count);
     //Assert.Equal(0, user.Claims.Count);
 }
Exemple #3
0
        public void UserStoreMethodsThrowWhenDisposedTest()
        {
            var db    = UnitTestHelper.CreateDefaultDb();
            var store = new UserStore <IdentityUser>(db);

            store.Dispose();
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.AddClaimAsync(null, null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.AddLoginAsync(null, null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.AddToRoleAsync(null, null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.GetClaimsAsync(null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.GetLoginsAsync(null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.GetRolesAsync(null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.IsInRoleAsync(null, null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.RemoveClaimAsync(null, null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.RemoveLoginAsync(null, null)));
            Assert.Throws <ObjectDisposedException>(
                () => AsyncHelper.RunSync(() => store.RemoveFromRoleAsync(null, null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.RemoveClaimAsync(null, null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.FindAsync(null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.FindByIdAsync(null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.FindByNameAsync(null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.UpdateAsync(null)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.DeleteAsync(null)));
            Assert.Throws <ObjectDisposedException>(
                () => AsyncHelper.RunSync(() => store.SetEmailConfirmedAsync(null, true)));
            Assert.Throws <ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.GetEmailConfirmedAsync(null)));
            Assert.Throws <ObjectDisposedException>(
                () => AsyncHelper.RunSync(() => store.SetPhoneNumberConfirmedAsync(null, true)));
            Assert.Throws <ObjectDisposedException>(
                () => AsyncHelper.RunSync(() => store.GetPhoneNumberConfirmedAsync(null)));
        }
 public void UserStoreMethodsThrowWhenDisposedTest()
 {
     var db = UnitTestHelper.CreateDefaultDb();
     var store = new UserStore<IdentityUser>(db);
     store.Dispose();
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.AddClaimAsync(null, null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.AddLoginAsync(null, null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.AddToRoleAsync(null, null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.GetClaimsAsync(null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.GetLoginsAsync(null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.GetRolesAsync(null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.IsInRoleAsync(null, null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.RemoveClaimAsync(null, null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.RemoveLoginAsync(null, null)));
     Assert.Throws<ObjectDisposedException>(
         () => AsyncHelper.RunSync(() => store.RemoveFromRoleAsync(null, null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.RemoveClaimAsync(null, null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.FindAsync(null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.FindByIdAsync(null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.FindByNameAsync(null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.UpdateAsync(null)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.DeleteAsync(null)));
     Assert.Throws<ObjectDisposedException>(
         () => AsyncHelper.RunSync(() => store.SetEmailConfirmedAsync(null, true)));
     Assert.Throws<ObjectDisposedException>(() => AsyncHelper.RunSync(() => store.GetEmailConfirmedAsync(null)));
     Assert.Throws<ObjectDisposedException>(
         () => AsyncHelper.RunSync(() => store.SetPhoneNumberConfirmedAsync(null, true)));
     Assert.Throws<ObjectDisposedException>(
         () => AsyncHelper.RunSync(() => store.GetPhoneNumberConfirmedAsync(null)));
 }
Exemple #5
0
        public Task AddClaimAsync(Contracts.User user, System.Security.Claims.Claim claim)
        {
            var identityUser = ToIdentityUser(user);
            var task         = userStore.AddClaimAsync(identityUser, claim);

            return(task);
        }
        public async void RemoveClaimAsync_GivenAUserAndClaim_RemovesTheClaim()
        {
            var applicationDatabaseConfiguration = new ApplicationDatabaseConfiguration();
            var userStore = new UserStore<User>(applicationDatabaseConfiguration);

            var user = new User
            {
                Email = "*****@*****.**",
                IsEmailConfirmed = true,
                PasswordHash = "PasswordHash",
                PhoneNumber = "PhoneNumber",
                IsPhoneNumberConfirmed = true,
                IsTwoFactorEnabled = false,
                LockoutEndDateUtc = null,
                IsLockoutEnabled = true,
                AccessFailedCount = 0,
                UserName = "******",
                IsAccountActive = true
            };

            await userStore.CreateAsync(user);

            var insertedUser = await userStore.FindByIdAsync(user.Id);

            await userStore.AddClaimAsync(insertedUser, new Claim("ClaimType2", "ClaimValue2"));

            await userStore.RemoveClaimAsync(insertedUser, new Claim("ClaimType2", "ClaimValue2"));

            IList<Claim> claims = await userStore.GetClaimsAsync(user);

            claims.Should().HaveCount(0);
        }
Exemple #7
0
        public async void RemoveClaimAsync_GivenAUserAndClaim_RemovesTheClaim()
        {
            var applicationDatabaseConfiguration = new ApplicationDatabaseConfiguration();
            var userStore = new UserStore <User>(applicationDatabaseConfiguration);

            var user = new User
            {
                Email                  = "*****@*****.**",
                IsEmailConfirmed       = true,
                PasswordHash           = "PasswordHash",
                PhoneNumber            = "PhoneNumber",
                IsPhoneNumberConfirmed = true,
                IsTwoFactorEnabled     = false,
                LockoutEndDateUtc      = null,
                IsLockoutEnabled       = true,
                AccessFailedCount      = 0,
                UserName               = "******",
                IsAccountActive        = true
            };

            await userStore.CreateAsync(user);

            var insertedUser = await userStore.FindByIdAsync(user.Id);

            await userStore.AddClaimAsync(insertedUser, new Claim("ClaimType2", "ClaimValue2"));

            await userStore.RemoveClaimAsync(insertedUser, new Claim("ClaimType2", "ClaimValue2"));

            IList <Claim> claims = await userStore.GetClaimsAsync(user);

            claims.Should().HaveCount(0);
        }
Exemple #8
0
        public async Task <IHttpActionResult> AddClaimAsync(string userId, Claim claim)
        {
            await UserStore.AddClaimAsync
            (
                await UserStore.FindByIdAsync(userId),
                claim
            );

            return(Ok());
        }
        public async Task AddRemoveUserClaimTest()
        {
            var db    = UnitTestHelper.CreateDefaultDb();
            var store = new UserStore <IdentityUser>(db);

            ;
            var user = new IdentityUser("ClaimsAddRemove");
            await store.CreateAsync(user);

            Claim[] claims = { new Claim("c", "v"), new Claim("c2", "v2"), new Claim("c2", "v3") };
            foreach (Claim c in claims)
            {
                await store.AddClaimAsync(user, c);
            }
            await store.UpdateAsync(user);

            var userClaims = await store.GetClaimsAsync(user);

            Assert.Equal(3, userClaims.Count);
            await store.RemoveClaimAsync(user, claims[0]);

            Assert.Equal(3, userClaims.Count); // No effect until save changes
            db.SaveChanges();
            userClaims = await store.GetClaimsAsync(user);

            Assert.Equal(2, userClaims.Count);
            await store.RemoveClaimAsync(user, claims[1]);

            Assert.Equal(2, userClaims.Count); // No effect until save changes
            db.SaveChanges();
            userClaims = await store.GetClaimsAsync(user);

            Assert.Equal(1, userClaims.Count);
            await store.RemoveClaimAsync(user, claims[2]);

            Assert.Equal(1, userClaims.Count); // No effect until save changes
            db.SaveChanges();
            userClaims = await store.GetClaimsAsync(user);

            Assert.Equal(0, userClaims.Count);
            //Assert.Equal(0, user.Claims.Count);
        }
Exemple #10
0
        private async Task MigrateUser(dynamic userData)
        {
            var userId = userData.UserID.ToString();
            var user   = await _userStore.FindByIdAsync(userId);

            if (user == null)
            {
                await _userStore.CreateAsync(new T { Id = userId });

                user = await _userStore.FindByIdAsync(userId);

                if (user == null)
                {
                    Logger.Error("Unable to create user: "******"New user, adding login info...");
                await _userStore.AddLoginAsync(user, new UserLoginInfo(_loginProvider, userId));
            }
            IList <Claim> existingClaims = await _userStore.GetClaimsAsync(user);

            var data = (IDictionary <string, object>)userData;

            foreach (var property in _properties)
            {
                var type = ProfileClaimNamespace + property.ToLower();
                if (existingClaims.Any(x => x.Type == type))
                {
                    await _userStore.RemoveClaimAsync(user, existingClaims.First(x => x.Type == type));

                    Logger.Trace("Existing claim removed: " + type);
                }
                var value = data[property]?.ToString() ?? "";
                await _userStore.AddClaimAsync(user, new Claim(type, value));
            }
        }
 public void Should_throw_argument_null_exception_if_user_is_null()
 {
     Assert.Throws <ArgumentNullException>(() => _target.AddClaimAsync(null, new Claim(ClaimTypes.Email, "")));
 }
Exemple #12
0
 public Task AddClaimAsync(IUser user, Claim claim)
 {
     return(_userStore.AddClaimAsync((MongoApplicationUser)user, claim));
 }
        public void AddRemoveUserClaim()
        {
            using (UserStore <IdentityUser> store = new UserStore <IdentityUser>(new IdentityCloudContext <IdentityUser>()))
            {
                using (UserManager <IdentityUser> manager = new UserManager <IdentityUser>(store))
                {
                    var user = User;
                    WriteLineObject <IdentityUser>(user);
                    Claim claim         = GenAdminClaim();
                    var   userClaimTask = manager.AddClaimAsync(user.Id, claim);
                    userClaimTask.Wait();
                    Assert.IsTrue(userClaimTask.Result.Succeeded, string.Concat(userClaimTask.Result.Errors));
                    var claimsTask = manager.GetClaimsAsync(user.Id);
                    claimsTask.Wait();
                    Assert.IsTrue(claimsTask.Result.Any(c => c.Value == claim.Value & c.ValueType == claim.ValueType), "Claim not found");


                    var userRemoveClaimTask = manager.RemoveClaimAsync(user.Id, claim);
                    userRemoveClaimTask.Wait();
                    Assert.IsTrue(userClaimTask.Result.Succeeded, string.Concat(userClaimTask.Result.Errors));
                    var claimsTask2 = manager.GetClaimsAsync(user.Id);
                    claimsTask2.Wait();
                    Assert.IsTrue(!claimsTask2.Result.Any(c => c.Value == claim.Value & c.ValueType == claim.ValueType), "Claim not removed");

                    try
                    {
                        var task = store.AddClaimAsync(null, claim);
                        task.Wait();
                    }
                    catch (AggregateException aggex)
                    {
                        if (!(aggex.InnerException is ArgumentException))
                        {
                            throw;
                        }
                    }

                    try
                    {
                        store.AddClaimAsync(user, null);
                    }
                    catch (ArgumentException) { }

                    try
                    {
                        store.RemoveClaimAsync(null, claim);
                    }
                    catch (ArgumentException) { }

                    try
                    {
                        store.RemoveClaimAsync(user, null);
                    }
                    catch (ArgumentException) { }

                    try
                    {
                        store.RemoveClaimAsync(user, new Claim(string.Empty, Guid.NewGuid().ToString()));
                    }
                    catch (ArgumentException) { }

                    try
                    {
                        store.RemoveClaimAsync(user, new Claim(claim.Type, string.Empty));
                    }
                    catch (ArgumentException) { }

                    try
                    {
                        store.GetClaimsAsync(null);
                    }
                    catch (ArgumentException) { }
                }
            }
        }
 public void UserStorePublicNullCheckTest()
 {
     var store = new UserStore<IdentityUser>();
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.CreateAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.UpdateAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.DeleteAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.AddClaimAsync(null, null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.RemoveClaimAsync(null, null)),
         "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetClaimsAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetLoginsAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetRolesAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.AddLoginAsync(null, null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.RemoveLoginAsync(null, null)),
         "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.AddToRoleAsync(null, null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.RemoveFromRoleAsync(null, null)),
         "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.IsInRoleAsync(null, null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetPasswordHashAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.SetPasswordHashAsync(null, null)),
         "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetSecurityStampAsync(null)),
         "user");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.SetSecurityStampAsync(null, null)), "user");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.AddClaimAsync(new IdentityUser("fake"), null)), "claim");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.RemoveClaimAsync(new IdentityUser("fake"), null)), "claim");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.AddLoginAsync(new IdentityUser("fake"), null)), "login");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.RemoveLoginAsync(new IdentityUser("fake"), null)), "login");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.FindAsync(null)), "login");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetEmailConfirmedAsync(null)),
         "user");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.SetEmailConfirmedAsync(null, true)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetEmailAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.SetEmailAsync(null, null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetPhoneNumberAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.SetPhoneNumberAsync(null, null)),
         "user");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.GetPhoneNumberConfirmedAsync(null)), "user");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.SetPhoneNumberConfirmedAsync(null, true)), "user");
     ExceptionHelper.ThrowsArgumentNull(() => AsyncHelper.RunSync(() => store.GetTwoFactorEnabledAsync(null)),
         "user");
     ExceptionHelper.ThrowsArgumentNull(
         () => AsyncHelper.RunSync(() => store.SetTwoFactorEnabledAsync(null, true)), "user");
     ExceptionHelper.ThrowsArgumentNullOrEmpty(
         () => AsyncHelper.RunSync(() => store.AddToRoleAsync(new IdentityUser("fake"), null)), "roleName");
     ExceptionHelper.ThrowsArgumentNullOrEmpty(
         () => AsyncHelper.RunSync(() => store.RemoveFromRoleAsync(new IdentityUser("fake"), null)), "roleName");
     ExceptionHelper.ThrowsArgumentNullOrEmpty(
         () => AsyncHelper.RunSync(() => store.IsInRoleAsync(new IdentityUser("fake"), null)), "roleName");
 }