Example #1
0
        public async Task When__UserStore_Add_Claim__Expect__Claim_Added()
        {
            Claim           claim  = new Claim("Delete Log", "Yes");
            int             userId = 1;
            ApplicationUser user   = await _userStore.FindByIdAsync(userId).ConfigureAwait(false);

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

            await _userStore.AddClaimAsync(user, claim).ConfigureAwait(false);

            _unitOfWork.SaveChanges();

            IList <Claim> claims = await _userStore.GetClaimsAsync(user).ConfigureAwait(false);

            Claim savedClaim = claims.Where(p =>
                                            p.Type == claim.Type &&
                                            p.Value == claim.Value).FirstOrDefault();

            Assert.That(savedClaim, Is.Not.Null, "Claim not added");
        }