3
假設我有一個接口IReportBuilderService和具體類ReportBuilderService如何嘲笑通用抽象類
e.g. public class ReportBuilderService : IReportBuilderService { }
我可以開始使用起訂量來模擬這種服務本身
Mock<IReportBuilderService> _reportBuilderServiceMock = new Mock<IReportBuilderService>();
和模擬預期等因素對模擬課,好吧沒問題。
問題:如何模擬以下方法簽名?
public abstract class ReportBuilder<TReport> where TReport : Report, new()
其中黎港被定義爲
public class SomeReport : ReportBuilder<Report>, IMapper{}
,並報告類只是
public class Report { }
在抽象類的ReportBuilder有一系列屬性獲取/套,它是這些我試圖僞造/嘲笑的價值。
但我不能開始得到這個抽象類的正確模擬下手
希望這是有道理
Thanks Dominic:是的,這是缺乏虛擬屬性,趕上了我 – Rory 2013-03-01 17:38:16