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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:02:28+00:00 2026-06-01T21:02:28+00:00

For my ASP.NET MVC3 (new) development, I don’t want to create a dependency on

  • 0

For my ASP.NET MVC3 (new) development, I don’t want to create a dependency on MvcContrib TestHelper (and thus Rhino Mocks) unless it is providing significant value. So I’m seeking to understand the current status of this helper.

The documentation says that TestHelper produces fakes for the following controller dependencies:

  • HttpContext
  • HttpRequest
  • HttpResponse
  • HttpSession
  • Form
  • TempData
  • QueryString
  • ApplicationPath
  • PathInfo

For MVC1 and MVC2 I can see why this was so helpful. But MVC3 started to introduce improved test “seams” which may have made TestHelper less pertinent. For example, the MVC3 Request and Response controller properties were designed specifically to be isolateable/injectable versions of HttpRequest and HttpResponse.

As I’m still exploring testability advancements in MVC3, I’d like to know how many of the other dependencies listed above have received improved isolation (or injectability) in MVC3. I’d also love to see samples of code showing what it looks like in MVC3 to create tests with fakes (stubs / mocks) for the above dependencies WITH and WITHOUT using TestHelper.

If the differences in test-writing with and without TestHelper are sufficiently marginal, then I’d prefer to forego TestHelper…which means I am then free to choose whatever isolation framework I like (MOQ or NSubstitute).

Ultimately I would be surprised to learn the MVC3 release had taken specific improved testability steps for HttpRequest and HttpResponse, but not for the other above listed dependency issues. I’m hoping someone can give a break-down of how the above items are isolated without using TestHelper.

  • 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-01T21:02:31+00:00Added an answer on June 1, 2026 at 9:02 pm

    But MVC3 started to introduce improved test “seams” which may have
    made TestHelper less pertinent. For example, the MVC3 Request and
    Response controller properties were designed specifically to be
    isolateable/injectable versions of HttpRequest and HttpResponse.

    MVC didn’t introduce absolutely anything new in respect to the objects you have listed in your question in terms of unit testabaility. They were abstractions in ASP.NET MVC 1 and 2 and are abstractions in ASP.NET MVC 3. This allows you to unit test your controller actions and code that depends on them in isolation. But in order to do that you need to mock those dependencies. That’s where a mocking framework comes into play. Rhino Mocks is just one possible framework. MVCContrib.TestHelper provides a really nice and fluent syntax to unit test controller actions. Personally I use it all the time. It really makes the unit tests more readable and avoids cluttering them with all kind of plumbing, mocking and infrastructure code.

    Check this unit test for example: https://github.com/darind/samplemvc/blob/master/tests/SampleMvc.Web.Tests/Controllers/UsersControllerTests.cs

    ASP.NET MVC 3 introduced a dependency resolver and providers which allows you to inject dependencies into many other parts of the framework other than simple controllers and thus unit test those parts which previously were difficult. For example action filters.

    But in terms of the actual unit test it doesn’t change anything:

    1. you create a mock to represent some object that the subject under test depends upon and that you can control in your unit test
    2. you define expectations on the mocked object
    3. you call the actual method you are testing
    4. you assert on the results
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem with the asp.net MVC3. when i create a new project
Firstly, I'm new to MVC - and trying out ASP.NET MVC3. I want to
I brand new to ASP.NET MVC3. How would I create a global custom error
I'm rather new to ASP .NET MVC3. I know that when I create my
I am new to ASP.NET MVC 3 and I want to have username/id as
I'm developing a ASP.Net MVC3 app which will have few hundred videos. I want
I am new to ASP.NET MVC3 and trying desperately to just get something simple
I'm fairly new to asp.net MVC3. I followed the link below http://blogs.msdn.com/b/rickandy/archive/2011/05/02/securing-your-asp-net-mvc-3-application.aspx it all
I am an ASP.NET WebForms programmer and I'm very new to ASP.NET MVC3. I've
When creating a new asp.net mvc3 app you get the logon and register form

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.