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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:14:12+00:00 2026-05-28T15:14:12+00:00

I have a solution with differents projects in it, One those is an MVC

  • 0

I have a solution with differents projects in it, One those is an MVC 3 project, and the other is a test project.

From the test project, I’m trying to test my controllers behavior. But when I’m running a test the system throws an error telling me this:

System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

The code from the test os the following:

[TestMethod]
public void TestMethod()
{
    var myService = new Mock<IMyService>();
    myService.Setup(a => a.ReadAuthorizationRequest())
        .Returns<EndUserAuthorizationRequest>(null);
    int error = 0;
    var controller = new myController(myService.Object);

    try
    {
        var actionResult = controller.Authorize();
    }
    catch (HttpException exception)
    {
        error = exception.GetHttpCode();
    }
    Assert.AreEqual(403, error);
}

the controller:

public class myController: Controller
{
    private readonly IMyService _service;

    public OAuthController(IMyService service)
    {
        _service = service;
    }

    [Authorize, AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
    public ActionResult Authorize()
    {
        ClientApplication requestingClient;
        var request = _service.ReadAuthorizationRequest();
        if (request == null)
        {
            throw new HttpException((int) HttpStatusCode.BadRequest,
                "Missing authorization request.");
        }
     }
}

As you can see, I’m trying to test the controller behavior, so that, whenever the service doesn’t read the request the controller should throw an httpException with httpStatusCode 403.

What is wrong with this. Thank you in advance.

  • 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-28T15:14:13+00:00Added an answer on May 28, 2026 at 3:14 pm

    From your exception:

    System.IO.FileNotFoundException: Could not load file or assembly ‘System.Web.Mvc, Version=1.0.0.0

    It is trying to load MVC version 1. You probably need to do an assembly binding redirect in your test project as well, same as the one in the web.config:

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    

    Place that in the configuration section of the app.config of your test assembly.

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

Sidebar

Related Questions

I have a solution with several projects. One of them is a setup project.
I have a solution with many projects. One project contain few custom components. One
We have two WebApplication in one MVC solution, one for Desktop and the other
I have one solution in VS2010 containing two MVC 3 projects. These are two
I have a solution with several projects, where the startup project has a post-build
I'm building an ASP.Net MVC website. Rather than have everything in one project, I've
I have a Visual Studio 2010 solution with several projects. One of the projects
We have a large solution (195 projects) and on one of the projects I'm
I want certain projects in my solution opened in Visual Studio have different icons..Just
I have a solution consisting of five projects, each of which compile to separate

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.