代码如下:
IServiceCollection services = new ServiceCollection();
var mock = new Mock<IHostingEnvironment>();
mock.Setup(env => env.ContentRootPath).Returns(Directory.GetCurrentDirectory());
请问如何注入IHostingEnvironment的mock实例mock.Object?
services.AddTransient<IHostingEnvironment>(_ => mock.Object);