Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8020985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:50:34+00:00 2026-06-04T21:50:34+00:00

I have a controller in the admin section of my site and it is

  • 0

I have a controller in the admin section of my site and it is decorated with the Authorize filter with the role set to admin.

[Authorize(Roles = "Admin")]
public class SubscriberController : Controller

This works great but I’d like to create a unit test to ensure that the filter is not removed. I’ve got this far, to validate that the Authorize filter is present.

        typeof(SubscriberController).Should()
            .BeDecoratedWith<AuthorizeAttribute>(
                "Subscriber controller users must be admins");

How can I validate the Roles argument? I am using Fluent Assertion 1.7.1.1.

It is possible now in Fluent Assertion v2:

    typeof(SubscriberController).Should()
        .BeDecoratedWith<AuthorizeAttribute>(a => a.Roles.Contains("Admin"),
            "Subscriber controller users must be admins");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:50:35+00:00Added an answer on June 4, 2026 at 9:50 pm

    Looks like that isn’t possible now – Testing Arguments of Attributes

    You can up this thread and ask about progress.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have @Controller @RequestMapping(value=core/*) public class CoreController { public static String exceptionOccurredView = /core/exceptionOccurred;
I have this code in my controller (admin): function save(){ $model = $this->getModel('mymodel'); if
I have Admin controller in codeigniter class Admin extends CI_Controller { function __construct() {
I have multiple controllers one in Areas /Areas/Demo/Admin/AdminController and other in main site /Controller/Admin/AdminController
I have a controller called 'admin' class Admin extends CI_Controller { and under the
I have a controller called Admin with a number of Actions. In the URL,
I have an admin controller located in controllers/admin/admin_controller.rb I also have a pages controller
I have Controller: [MySite]\Controllers\DistributionTools\TrackingChannelsController.cs [HttpPost] public void InitTcFirstPageView() { var model = new TcFirstPageModel
I'm writing an admin section to a site using CodeIgniter. I am writing an
I have an admin section that has a sub-directory of the controllers directory. I.e.,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.