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

  • Home
  • SEARCH
  • 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 6127811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:33:17+00:00 2026-05-23T16:33:17+00:00

I’m working on writing a non-trivial unit test (perhaps better called a UI test?).

  • 0

I’m working on writing a non-trivial “unit test” (perhaps better called a “UI test”?). In this case, I think I want a test that (reflectively?) finds all appropriate action handlers and then verifies that our SiteMap has a node for those Action Handlers. What I need is to identify when a developer adds a page to our system and forgets to add it to the SiteMap (this seems to be a common problem and I’d like to make it go away, which a test should easily be able to do for us). Ultimately, we want to make sure that any page that a user can land on will have a home in our SiteMap so that it builds the appropriate breadcrumb to tell the user where they are in our system (that breadcrumb part already works perfect for us, as long as the page is in the SiteMap). I would much rather try to do this with a test than try to force some policy/procedure update on us that is yet another thing we have to deal with.

Any tips on some existing code to start from in this endeavor? And if not, any thoughts on the best way to do this?

One possibility that I am considering is to reflectively identify any method that is decorated with the AcceptVerbs attribute which doesn’t have a return type of JsonResult (and perhaps a couple others which would clearly not be “web pages” such as FileResult). And perhaps limit my search by first identifying classes which inherit System.Web.Mvc.Controller.

I’d love to hear a better way to do this, though. And would love even more if most of this was already written and shared to save me some time. 🙂

  • 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-05-23T16:33:18+00:00Added an answer on May 23, 2026 at 4:33 pm

    Here is the important part of my solution. This works well for us.

            var mvcAssembly = typeof (AccountController).Assembly;
            AllControllers = mvcAssembly.GetTypes().Where(type => type.IsSubclassOf(typeof (Controller))).ToList();
            UnfilteredActionHandlers = new List<MethodInfo>();
            foreach (var controller in AllControllers)
            {
                UnfilteredActionHandlers.AddRange(controller.GetMethods()
                                                      .Where(methodInfo =>
                                                             typeof (ActionResult).IsAssignableFrom(methodInfo.ReturnType)
                                                             && !ControllerClassesToIgnore.Contains(methodInfo.ReflectedType)));
            }
    

    We have a few collections that we filter the UnfilteredActionHandlers collection by depending on how we want to use them:

        internal List<MethodInfo> UnfilteredActionHandlers { get; set; }
        internal List<MethodInfo> ActionHandlersExcludingFilteredReturnTypes { get; set; }
        internal List<MethodInfo> ActionHandlersFilteredByAttributes { get; set; }
        internal List<MethodInfo> ActionHandlersFilteredByBoth { get; set; }
    
    
        internal static List<Type> ReturnTypesToIgnore { get; set; }
        internal static List<Type> RequiredAttributes { get; set; }
        internal static List<Type> ControllerClassesToIgnore { get; set; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.