public void ReplaceClaim_NoExistingClaim_Ignores() { // note: per EF implemention - only existing claims are updated by looping through them so that impl ignores too var role = new IdentityRole(); var newClaim = new Claim("newType", "newValue"); role.ReplaceClaim(newClaim, newClaim); Assert.Empty(role.Claims); }
public void ReplaceClaim_TypeMatchesButValueDoesNot_DoesNotReplace() { var role = new IdentityRole(); var firstClaim = new Claim("sameType", "value"); role.AddClaim(firstClaim); var newClaim = new Claim("sameType", "newValue"); role.ReplaceClaim(new Claim("sameType", "wrongValue"), newClaim); role.ExpectOnlyHasThisClaim(firstClaim); }
public void ReplaceClaim_ValueMatchesButTypeDoesNot_DoesNotReplace() { var role = new IdentityRole(); var firstClaim = new Claim("type", "sameValue"); role.AddClaim(firstClaim); var newClaim = new Claim("newType", "sameValue"); role.ReplaceClaim(new Claim("wrongType", "sameValue"), newClaim); role.ExpectOnlyHasThisClaim(firstClaim); }
public void ReplaceClaim_ExistingClaim_Replaces() { var role = new IdentityRole(); var firstClaim = new Claim("type", "value"); role.AddClaim(firstClaim); var newClaim = new Claim("newType", "newValue"); role.ReplaceClaim(firstClaim, newClaim); role.ExpectOnlyHasThisClaim(newClaim); }