public void should_return_error_if_claims_parser_returns_error() { var fakeError = new FakeError(); this.Given(_ => GivenTheFollowing(new ClaimsPrincipal())) .And(_ => GivenTheParserReturns(new ErrorResponse <List <string> >(fakeError))) .And(_ => GivenTheFollowing(new List <string>() { "doesntmatter" })) .When(_ => WhenIAuthorise()) .Then(_ => ThenTheFollowingIsReturned(new ErrorResponse <bool>(fakeError))) .BDDfy(); }
public void should_not_match_scopes_and_return_error_result() { var fakeError = new FakeError(); var claimsPrincipal = new ClaimsPrincipal(); var allowedScopes = new List <string>() { "someScope" }; var userScopes = new List <string>() { "anotherScope" }; this.Given(_ => GivenTheFollowing(claimsPrincipal)) .And(_ => GivenTheParserReturns(new OkResponse <List <string> >(userScopes))) .And(_ => GivenTheFollowing(allowedScopes)) .When(_ => WhenIAuthorise()) .Then(_ => ThenTheFollowingIsReturned(new ErrorResponse <bool>(fakeError))) .BDDfy(); }