public void It_creates_and_inserts_new_userclaim() { ClaimsIdentity claims; using (var transaction = _database.GetTransaction()) { var user = _userTable.GetUserByName(name1).FirstOrDefault(); CreateUserClaim(user, cType1, cValue1); claims = _userClaimTable.FindByUserId(user.Id); transaction.Dispose(); } Assert.IsTrue(claims.HasClaim(cType1, cValue1)); }
public void It_creates_and_inserts_new_userclaim() { ClaimsIdentity claims; int result; using (var transaction = _database.GetTransaction()) { var user = _userTable.GetUserByName(name1).FirstOrDefault(); var claim = _claimTable.GetClaim(cType1, cValue1); result = _userClaimTable.Insert(claim, user.Id); claims = _userClaimTable.FindByUserId(user.Id); transaction.Dispose(); } Assert.AreEqual(1, result); Assert.IsTrue(claims.HasClaim(cType1, cValue1)); }
/// <summary> /// Gets the claims of a user as List of Claim /// </summary> /// <param name="user"></param> /// <returns></returns> public Task <IList <Claim> > GetClaimsAsync(TUser user) { var identity = _userClaimTable.FindByUserId(user.Id); return(Task.FromResult <IList <Claim> >(identity.Claims.ToList())); }