You are trying to set an expectation on a property that was defined to use PropertyBehavior. Instead of writing code such as this: mockObject.Stub(x => x.SomeProperty).Return(42); You can use the property directly to achieve the same result: 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;}
}
}
我在做什麼錯?
找到解決方案。退出該項目,以便我可以選擇適用的工具。例如Moq – Daniel 2012-08-07 15:19:09