Closed cknaap closed 6 years ago
No, it shouldn't. How can you mock an extension method? This method is about building a concrete implementation of an IServiceProvider.
Plus, the documentation on the method also says it returns IServiceProvider.
It was changed in 2.0 and needs to be updated /cc @Rick-Anderson
This issue was moved to aspnet/Home#2329
Method Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider returns a ServiceProvider instead of the associated interface IServiceProvider.
The latter allows for better mocking in unit tests.
Plus, the documentation on the method also says it returns IServiceProvider.