Using Modular StartUp with Integration Tests

Hi folks,

Is there a way to share/inject the configuration in the modular startup files into the apphost being used for integration tests? I know that you could manually configure the services in the test harness, but that introduces the risk that a developer may change the modular startup file (and the configuration between the integration tests and the running project would then be different)? The integration tests would all still pass, but the running application would now have an untested configuration baked into it…

I was thinking about creating some kind of shared library which could be referenced from both the api project and the test project…but I am not sure what that might look like…

The modular startup uses .NET’s HostingStartup which is scanned in the host assembly, it works because there’s only a single AppHost in Program.cs, it’s not going to work to initialize multiple integration AppHosts.

I wouldn’t rely on replicating any hosting startup magic, if you want code reuse I would refactor them into your own C# methods/classes that both make use of. But note that the concrete dependencies configured in Startup classes means any shared project will also need maintain the same concrete deps, which I don’t see any benefit of the extra maintenance burden for doing this over just having the test project reference the host project.

understood - thanks mythz…