Exemplo n.º 1
0
        public async Task When__UserStore_Add_Login__Expect__Login_Added()
        {
            UserLoginInfo   login  = new UserLoginInfo("Google", "E5A1F645-088A-4984-A7CE-CA1D48D30F92");
            int             userId = 1;
            ApplicationUser user   = await _userStore.FindByIdAsync(userId).ConfigureAwait(false);

            Assert.That(user, Is.Not.Null, "User not found");

            await _userStore.AddLoginAsync(user, login).ConfigureAwait(false);

            _context.SaveChanges();

            IList <UserLoginInfo> logins = await _userStore.GetLoginsAsync(user).ConfigureAwait(false);

            UserLoginInfo savedLogin = logins.Where(p =>
                                                    p.LoginProvider == login.LoginProvider &&
                                                    p.ProviderKey == login.ProviderKey).FirstOrDefault();

            Assert.That(savedLogin, Is.Not.Null, "Login not added");
        }