WebRootPath and TestServer

I have a XUnit test project with the following structure:

  • \MyApp.Rest
    • \wwwroot
  • \MyApp.Rest.Tests
    • Project reference to "MyApp.Rest"

_environment.WebRootPath in my integration tests is always null and I have some code in the tested project that depends on that value. I know I can set the value manually in the TestStartup. I am wondering if there is a better way to set the value other than hard-coding the path (C:\...\MyApp.Rest\wwwroot)?

public TestStartup(IHostingEnvironment environment, IServiceProvider serviceProvider) {
    _environment = environment;
    _environment.WebRootPath = "ugly_hardcoded_path_to_wwwroot"

    var builder = new ConfigurationBuilder()
    Configuration = builder.Build();