For integration testing Asp.Net Core application we have WebApplicationFactory. But how to test Worker
(HostedService
) that is not web application? I don't want to copy the whole DI configuration in SUT like in this question. Is it possible to use original configuration and override some of dependencies like we do for web application in WebApplicationFactory.WithWebHostBuilder?
Asked
Active
Viewed 2,473 times
9

Artur
- 4,595
- 25
- 38
1 Answers
1
I wasn't able to find any solution for Worker services integration testing hence I made adoption of WebApplicationFactory
. The source code and usage example can be found here:
https://github.com/gao-artur/WorkerService.Testing

Artur
- 4,595
- 25
- 38