I'm integration testing an ASP.NET Core app by using WebApplicationFactory. When starting the test server, I want to pass a command-line argument to the tested app, so to the Main method contained in the assembly to which TEntryPoint belongs. How to do that?
I tried using the nuget package Microsoft.Extensions.Configuration.CommandLine, but obviously that's for another purpose than what I want, as I don't want to configure the tested app differently.
override void ConfigureWebHostinWebApplicationFactory<Program>, and this way you could inject some overrides in configuration, then use it in web app - you would use CLI arguments, optionally overriding them with the config. This SO post might be of interest