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 6188195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:11:27+00:00 2026-05-24T02:11:27+00:00

Dear fellows from Stack Exchange. I’m trying to test if my Custom Model Binder

  • 0

Dear fellows from Stack Exchange.

I’m trying to test if my Custom Model Binder is being added to the ModelBinderProviders.BinderProviders collection.
I decided to activate this through WebActivator, to avoid messing global.asax,
Everything works fine, but the Test:

I tried using the WebActivator.ActivationManager.Run() method, but my things weren’t loaded.
I’ve something like this in my test:

[TestMethod] 
public void TemplateModelBinderProvider_Should_Be_Registered_In_BinderProviders()
{
    WebActivator.ActivationManager.Run();
    IModelBinderProvider templateModelBinderProvider = ModelBinderProviders.BinderProviders.
        Where(x => x is TemplateModelBinderProvider).
        FirstOrDefault();

    Assert.IsNotNull(templateModelBinderProvider);
}

And this is my app_Start class:

[assembly: WebActivator.PreApplicationStartMethod(typeof(MVC.App_Start.MVCBindings), "Start")]
namespace MVC.App_Start
{
    public static class MVCBindings
    {       
        public static void Start()
        {
            ModelBinderProviders.BinderProviders.Add(new TemplateModelBinderProvider());
        }
    }
}
  • 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-24T02:11:29+00:00Added an answer on May 24, 2026 at 2:11 am

    Sorry you have problems with the piece of code I wrote.

    I don’t have access to the source code right now but will take a look in the evening (UK time).

    Do you think you could send me your solution so I could replicate it locally? My email is jkonecki at gmail.com

    UPDATE

    I have received your source code but unfortunately it contains references to libraries I cannot obtain so I cannot compile it.

    I have created a separate solution (emailed to you) with MVC3 web app and unit test projects that uses your custom model binder provide. There are two tests that prove that WebActivatorManager.Run method properly registers a custom provider.

    Try debugging your unit test to make sure that Run method calls your static Start method.

    WebActivator source code is here – you might want to get it and step through.

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

Sidebar

Related Questions

Dear SQL Gurus from Stack Overflow: Environment: Oracle I'm trying to understand why I
Dear experts, I was trying to align an paragraph to the middle of an
Dear experts, I was trying to dynamically generate DOM elements using JS. I read
Dear All, I am trying to parse the following HTML fragment, and I would
I am trying to implement Custom Error handling via Action Filter Attributes. My code
Dear friends,I want to extract text 平均3.6 星 from this code segment excerpted from
Dear all, I am using java rmi for my program, from client side i
Dear Fellow Android Developers! EDIT: Thank you all for your answers. I see from
Dear all, I have a data frame which comes directly from a sensor. The
Hello dear programmers, I have a requirement for creating a custom tableviewcell with a

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.