起订量类库
我正在尝试找到一种适当的方法来订阅此问题,但我不确定如何做。这是一个.NET标准2.0库,必须从.NET 4.8和.NET CORE 3+消费。
这是一个例子。
private ILogService _logService;
public class Logger() :IProjectLogger
{
_logService = new LogService();
}
在测试Logger()时,我想浏览IlogService方法。但是,由于这可能并不总是与依赖注入一起使用,而且我不希望客户必须注入ilogservice,因此我在测试Logger()
谢谢!
I'm trying to find an appropriate way to Moq this, and I'm unsure on how to do it.This is a .Net Standard 2.0 library that must be consumed from .net 4.8, and .net core 3+.
Here is an Example.
private ILogService _logService;
public class Logger() :IProjectLogger
{
_logService = new LogService();
}
When testing Logger(), I would like to Moq the ILogService methods. But since this may not always be used with dependency injection, and I don't want the client to have to inject ILogService, I'm stuck on how to moq ILogService methods when testing Logger()
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论