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_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_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); }
private async Task AddRoles() { _adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")); _moderatorRole = new IdentityRole(_testData.RoleModeratorId, "moderator"); _moderatorRole.AddClaim(_guidGenerator, new Claim("test-claim", "test-value")); await _roleRepository.InsertAsync(_moderatorRole); _supporterRole = new IdentityRole(_guidGenerator.Create(), "supporter"); await _roleRepository.InsertAsync(_supporterRole); _managerRole = new IdentityRole(_guidGenerator.Create(), "manager"); await _roleRepository.InsertAsync(_managerRole); }