【发布时间】:2015-11-05 11:47:29
【问题描述】:
我使用 moq 进行单元测试已经有一段时间了,
我想知道为什么我的模拟对象即使它实现了接口方法也无法转换为接口在转换为接口后什么也不返回,这是我的简单代码:
POSRepository repo = this.mockPosRepository.Object;
IPOSRepository posRepo = repo;
if(repo.Prices.Count() > 0) // True
if(posRepo.Prices.Count() > 0) // false
我错过了什么吗?
【问题讨论】:
-
如何创建
this.mockPosRepository?
标签: c# .net unit-testing mocking moq