public void CanCheckIfUserHasClaim() { var claim = ClaimMother.CreateClaim("testing", "test"); var user = IdentityUserMother.UserWithClaimAndRole(claim); user.HasClaim(claim).ShouldBe(true); }
public void CannotAddDuplicateClaim() { var claim = ClaimMother.CreateClaim("testing", "test"); var user = IdentityUserMother.UserWithClaimAndRole(claim); user.AddClaim(claim).ShouldBe(false); }
public void CanAddClaim() { var claim = ClaimMother.CreateClaim("testing", "test"); var user = IdentityUserMother.EmptyUser(); user.AddClaim(claim).ShouldBe(true); user.Claims.ShouldContain(x => x.ClaimType == "testing" && x.ClaimValue == "test"); }
public void CanRemoveClaim() { var claim = ClaimMother.CreateClaim("testing", "test"); var user = IdentityUserMother.UserWithClaimAndRole(claim); user.RemoveClaim(claim).ShouldBe(true); user.Claims.ShouldBeEmpty(); }
public void CanGetClaims() { var claim = ClaimMother.CreateClaim("testing", "test"); var user = IdentityUserMother.UserWithClaimAndRole(claim); user.Claims.ShouldNotBeEmpty(); user.Claims.Count.ShouldBe(1); }
public void CannotRemoveClaimIfNotAssigned() { var claim = ClaimMother.CreateClaim("testing", "test"); var anotherClaim = ClaimMother.CreateClaim("testing1", "test1"); var user = IdentityUserMother.UserWithClaimAndRole(claim); user.RemoveClaim(anotherClaim).ShouldBe(false); }