I am trying to create a Mock (using Moq) for an IServiceProvider
so that I can test my repository class:
public class ApiResourceRepository : IApiRe
DISCLAIMER: The embedded links point to subpages of my GitHub and NuGet Page. But I hope it helps you or someone else, never the less.
I just created exaclty such a thing because I couldn't find any. It implements IServiceCollection and IServiceProvider to test my Startup-Configuration, especially, whether all types are registered properly to the DI-Container. And it is a general purpose replacement for those interfaces, providing Mocks (Moq) as singletons for each Registered Type. Foo
There is a readme.md on GitHub and the code base is not that big.
There is also a nuget package called MockProvider and - as mentioned - the code is on GitHub. I put it under MIT, so do what you want with it. It is free to use and contribute.
Consider it a way of giving back.