1

When trying to run a unit test I get this error:

Test Name: GetMethodTest Test FullName: Quanser.Codex.App.Web.Repository.UnitTests.DocumentsControllerTests.GetMethodTest Test Source: c:\Dev\Engineering\Mobile Apps\Software\Codex\trunk\Web\Repository\UnitTests.Repository\DocumentsControllerTests.cs : line 34 Test Outcome: Failed Test Duration: 0:00:00

Result Message: The URL specified ('http://localhost:53364/') does not correspond to a valid directory. Tests configured to run in ASP.NET in IIS require a valid directory to exist for the URL. The URL may be invalid or may not point to a valid Web application.

This is my test case:

    [TestMethod()]
    [HostType("ASP.NET")]
    [UrlToTest("http://localhost:53364/")]
    public void GetMethodTest() 
    {
      // ...
    }

I know there is something wrong with this line:

 [UrlToTest("http://localhost:53364/")]

What should I put as the Url in this attribute?

Note: I need to use these attributes for testing the REST API

Thanks

A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128
  • 1
    Perhaps it's a permission issue as described in [this post][1]. [1]: http://stackoverflow.com/questions/9065937/asp-net-unit-testing-windows7-iis7 – Dmitry Sadakov Apr 22 '15 at 19:04

1 Answers1

1

Those attributes are for testing ASP.NET Web Forms projects. If you only need to test your WebAPI Controllers then you should be able to just delete them, e.g.

[TestMethod()]
public void GetMethodTest() 
{
  // ...
}
DigitalDan
  • 2,477
  • 2
  • 28
  • 35