public void AuthorizeAuthenticatedAttribute_AsAnonymous() { var context = generateContext(); var admin = new AdminAttribute(); Assert.Throws <AuthorizationException>(() => admin.OnActionExecuting(context)); }
public void AuthorizeAdminAttribute_AsAdmin() { var context = generateContext(); context.HttpContext.Request.Headers["Authorization"] = "admin"; var admin = new AdminAttribute(); admin.OnActionExecuting(context); }
public void AuthorizeAdminAttribute_AsAuthenticated() { var context = generateContext(); context.HttpContext.Request.Headers["Authorization"] = "auth"; var admin = new AdminAttribute(); Assert.Throws <AuthorizationException>(() => admin.OnActionExecuting(context)); }