WebApplicationFactory throws error that contentRootPath does not exist in ASP.NET Core integration test

后端 未结 6 1255
醉梦人生
醉梦人生 2021-02-13 18:52

I have a ASP.NET Core project with some simple Razor pages and a Web API controller.

I\'m using Clean Architecture as a starting point. I\'ve renamed the project names,

6条回答
  •  无人及你
    2021-02-13 19:52

    This method worked for me

            var client = _factory
                .WithWebHostBuilder(builder => builder.UseSolutionRelativeContentRoot("relative/path/of/project/under/test"))
                .CreateClient();
    

    See How the test infrastructure infers the app content root path for more information.

提交回复
热议问题