public async Task HandlerSucceedsWhenUserIsAuthorizedToEdit_Administrator() { var tester = new AuthorizationHandlerTester < EditPresidentRequirement, EditPresidentHandler>( new EditPresidentRequirement(), new EditPresidentHandler()); tester.AddRouteDataValue("id", 123); tester.AddClaim(ClaimTypes.Role, SecurityConstants.RoleName_Admin); await tester.AssertSuccess(); }
public async Task HandlerSucceedsWhenUserIsAuthorizedToEdit_DirectPermissions() { var tester = new AuthorizationHandlerTester < EditPresidentRequirement, EditPresidentHandler>( new EditPresidentRequirement(), new EditPresidentHandler()); tester.AddRouteDataValue("id", 123); tester.AddClaim(SecurityConstants.PermissionName_Edit, "123"); await tester.AssertSuccess(); }