C
C#16mo ago
Dr_Cox1911

❔ WebApplicationFactory and Minimal-APIs

I've got problems with my integration tests and minimal apis. My app has a worker services that start right up when the actual api is starting. I have a custom WebApplicationFactory that will swap out the Database with one thats started by Testcontainers. My problem though: With the top level statements and the builder that minimal apis use it looks like the app is completely started and in parallel the builder of the WebApplicationFactory runs. My worker service crashes though, as it get's started before my custom WebApplicationFactory finishes with changing out the db. I've never faced these issues in the traditional Startup era, so can I use WebApplicationFactory properly with top level statements?
2 Replies
Dr_Cox1911
Dr_Cox1911OP16mo ago
GitHub
GitHub - MichaelHochriegl/WebAppFactoryHostedService: Example of th...
Example of the strange behavior of the WebApplicationFactory with top level statements and e.g. HostedService - GitHub - MichaelHochriegl/WebAppFactoryHostedService: Example of the strange beha...
Accord
Accord16mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server