Created
March 20, 2017 19:46
-
-
Save Lutando/970dc0e68b88b6a277b28a400cbe4f6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
[Trait("Category", Category)] | |
public async void HandleEdit_WhenCalledWithResourceOwner_ShouldSucceed() | |
{ | |
var resource = make_PostDefault(); | |
var authorizationModel = PostAuthorizationModel.From(resource); | |
var user = new ClaimsPrincipal(new ClaimsIdentity(new List<Claim> { new Claim("sub", UserIdDefault.ToString()) })); | |
var requirement = PostOperations.Edit; | |
var authorizationContext = new AuthorizationHandlerContext(new List<IAuthorizationRequirement> { requirement }, user, authorizationModel); | |
var authorizationHandler = new PostAuthorizationHandler(); | |
await authorizationHandler.HandleAsync(authorizationContext); | |
Assert.True(authorizationContext.HasSucceeded); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment