title: Integrated Unit Testing is not running in ASP.NET core MVC/Web API
body: <p>I am developing a web API using ASP.Net core. I am doing integrated testing to my project. I am following this link, <a href="https://koukia.ca/integration-testing-in-asp-net-core-2-0-51d14ede3968" rel="nofollow noreferrer">https://koukia.ca/integration-testing-in-asp-net-core-2-0-51d14ede3968</a>. This is my code.</p>
  <p>I have the controller to be tested in the thegoodyard.api project.</p>
  <pre><code>namespace thegoodyard.api.Controllers
  {
     [Produces(&quot;application/json&quot;)]
     [Route(&quot;api/category&quot;)]
     public class CategoryController: Controller
     {
        [HttpGet(&quot;details/{id}&quot;)]
        public string GetCategory(int id = 0)
        {
           return &quot;This is the message: &quot; + id.ToString();
        }
     }
  }
  </code></pre>
  <p>I added a new unit test project called thegoodyard.tests to the solution. I added a TestServerFixture class with the following definition</p>
  <pre><code>namespace thegoodyard.tests
  {
      public class TestServerFixture : IDisposable
      {
        private readonly TestServer _testServer;
        public HttpClient Client { get; }
  
        public TestServerFixture()
        {
           var builder = new WebHostBuilder()
                  .UseContentRoot(GetContentRootPath())
                  .UseEnvironment(&quot;Development&quot;)
                  .UseStartup&lt;Startup&gt;();  // Uses Start up class from your API Host project to configure the test server
  
           _testServer = new TestServer(builder);
           Client = _testServer.CreateClient();
        }
  
        private string GetContentRootPath()
        {
           var testProjectPath = PlatformServices.Default.Application.ApplicationBasePath;
           var relativePathToHostProject = @&quot;..\..\..\..\..\..\thegoodyard.api&quot;;
           return Path.Combine(testProjectPath, relativePathToHostProject);
        }
  
        public void Dispose()
        {
           Client.Dispose();
           _testServer.Dispose();
        }
     }
  }
  </code></pre>
  <p>Then again in the test project, I created a new class called, CategoryControllerTests with the following definition.</p>
  <pre><code>namespace thegoodyard.tests
  {
      public class CategoryControllerTests: IClassFixture&lt;TestServerFixture&gt;
     {
        private readonly TestServerFixture _fixture;
  
        public CategoryControllerTests(TestServerFixture fixture)
        {
           _fixture = fixture;
        }
  
        [Fact]
        public async Task GetCategoryDetai()
        {
           var response = await _fixture.Client.GetAsync(&quot;api/category/details/3&quot;);
  
           response.EnsureSuccessStatusCode();
  
           var responseString = await response.Content.ReadAsStringAsync();
  
           bool containMessage = false; //responseString.Contains(&quot;This is the message: 3&quot;); - I commented on purpose to make the test fails.
           Assert.True(containMessage);
        }
     }
  }
  </code></pre>
  <p>Then I right on the test method and clicked run tests in the option to run the test. But none of the tests was run. This is the output.
  <a href="https://i.stack.imgur.com/JR150.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JR150.png" alt="enter image description here" /></a></p>
  <p>What is missing in my code? How can I get my integrated test running?</p>