public void ShouldReturnUnAuthorized() { var authAttr = new AllowedUserAttribute(); authAttr.OnAuthorization(authorizationFilterContext); authorizationFilterContext.Result.Should().BeOfType <UnauthorizedResult>(); }
public void ShouldReturnSuccessful() { controller.ControllerContext.HttpContext.User = GetTestUser("ttcg"); var authAttr = new AllowedUserAttribute("ttcg"); authAttr.OnAuthorization(authorizationFilterContext); authorizationFilterContext.Result.Should().BeNull(); // null means successful }
public void ShouldReturnForbidden() { controller.ControllerContext.HttpContext.User = GetTestUser("test"); var authAttr = new AllowedUserAttribute("ttcg"); authAttr.OnAuthorization(authorizationFilterContext); authorizationFilterContext.Result.Should().BeOfType <ForbidResult>(); }