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)); }
public void It_creates_and_inserts_new_client_claim_with_existing_global_claim() { var result = 0; IdentityClaim existingClaim, resultingClaim; using (var transaction = _database.GetTransaction()) { result = CreateClaim(claimType1, claimValueAccount1); existingClaim = _claimTable.GetClaim(claimType1, claimValueAccount1); result = _claimTable.Insert(new IdentityClaim(clientId, claimType1, claimValueAccount1)); resultingClaim = _claimTable.GetClaim(claimType1, claimValueAccount1); transaction.Dispose(); } Assert.AreEqual(existingClaim.Id, resultingClaim.Id); Assert.IsTrue(resultingClaim.Id.StartsWith("CL")); Assert.AreEqual(claimType1, resultingClaim.Type); Assert.AreEqual(claimValueAccount1, resultingClaim.Value); Assert.IsNull(resultingClaim.ClientId); Assert.AreEqual(3, result); }