.Net Core 3 Worker 集成测试

.Net Core 3 Worker Integration Tests

对于集成测试 Asp.Net 我们有核心应用程序 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 . Is it possible to use original configuration and override some of dependencies like we do for web application in WebApplicationFactory.WithWebHostBuilder?

我找不到任何用于 Worker 服务集成测试的解决方案,因此我采用了 WebApplicationFactory。源代码和使用示例可以在这里找到: https://github.com/gao-artur/WorkerService.Testing