我正在尝试使用 Telerik JustMock 模拟属性。
public WorkitemBusinessObject mock()
{
var mockContext = Mock.Create<BusinessObjectContext<Workitem>>();
var workitemList = new List<Workitem> {
new Workitem {Title="First Workitem"}
};
Mock..Arrange(() => mockContext.Table).Returns(workitemList.AsQueryable<Workitem>);
Mock.Arrange(() => mockContext.Query).CallOriginal();
Mock.Arrange(() => BusinessObjectContext<Workitem>.TableName).CallOriginal();
node.context = mockContext;
return this;
}
这不起作用。它给出了一个标题为“Opps,拦截目标调用时出错。-异常”的异常
有任何想法吗?