错误:
您正在尝试对定义为使用 PropertyBehavior 的属性设置期望。而不是编写这样的代码:mockObject.Stub(x => x.SomeProperty).Return(42); 您可以直接使用该属性来达到相同的结果:mockObject.SomeProperty = 42;
var x = MockRepository.GenerateStub<MyClass>();
x.Stub(s => s.Items).Return(new List<Item>());
public class MyClass
{
public virtual IEnumerable<Item> Items
{
get {return _items;}
private set {_items = value;}
}
}
我究竟做错了什么?