public void Should_return_true_for_valid_claim_if_the_validation_succeeds() { // Given IUserIdentity user = GetFakeUser("Fake", new[] { "present-claim1", "present-claim2", "present-claim3" }); Func <IEnumerable <string>, bool> isValid = claims => true; // When var result = user.HasValidClaims(isValid); // Then result.ShouldBeTrue(); }
public void Should_return_false_for_valid_claim_if_claims_are_null() { // Given IUserIdentity user = GetFakeUser("Fake"); Func <IEnumerable <string>, bool> isValid = claims => true; // When var result = user.HasValidClaims(isValid); // Then result.ShouldBeFalse(); }
public void Should_call_validation_with_users_claims() { // Given IEnumerable <string> userClaims = new string[0]; IUserIdentity user = GetFakeUser("Fake", userClaims); IEnumerable <string> validatedClaims = null; Func <IEnumerable <string>, bool> isValid = claims => { // store passed claims for testing assertion validatedClaims = claims; return(true); }; // When user.HasValidClaims(isValid); // Then validatedClaims.ShouldBeSameAs(userClaims); }