-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Description
I am seeing an issue when I try to create an integration test with a custom WebApplicationFactory. I get the error below but what is puzzling is the path is missing one folder in the path and I don't know where this value is coming from. It should be '/Users/richardguthrie/go/src/github.com/Azure-Samples/openhack-devops-team/apis/poi/tests/IntegrationTests'
The code is checked in at: https://github.com/Azure-Samples/openhack-devops-team/tree/unit_test3
Is this a bug or am I missing something when I try to init the webhost that would fix this? My intent is to spin up a server locally with in memory db to run the integration test. This happens when I run Debug Test from within VSCode using C# extension.
[xUnit.net 00:00:26.3698120] IntegrationTests.POIIntegrationTests.Get_EndpointsReturnSuccessAndCorrectContentType(url: "/api/poi/") [FAIL]
[xUnit.net 00:00:26.3715660] System.ArgumentException : The content root '/Users/richardguthrie/go/src/github.com/Azure-Samples/openhack-devops-team/apis/poi/IntegrationTests' does not exist.
[xUnit.net 00:00:26.3716860] Parameter name: contentRootPath
[xUnit.net 00:00:26.3732960] Stack Trace:
[xUnit.net 00:00:26.3754940] at Microsoft.AspNetCore.Hosting.Internal.HostingEnvironmentExtensions.Initialize(IHostingEnvironment hostingEnvironment, String contentRootPath, WebHostOptions options)
[xUnit.net 00:00:26.3756430] at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
[xUnit.net 00:00:26.3757000] at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
[xUnit.net 00:00:26.3758120] at Microsoft.AspNetCore.TestHost.TestServer..ctor(IWebHostBuilder builder, IFeatureCollection featureCollection)
[xUnit.net 00:00:26.3758790] at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory1.CreateServer(IWebHostBuilder builder) [xUnit.net 00:00:26.3760500] at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory
1.EnsureServer()
[xUnit.net 00:00:26.3761230] at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory1.CreateDefaultClient(DelegatingHandler[] handlers) [xUnit.net 00:00:26.3762400] at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory
1.CreateClient