I've just spent a full day trying to figure out why the following:
[Test]
public void Test()
{
using (RecordExpectations recorder = new RecordExpectations())
{
Foo foo = new Foo();
recorder.ExpectAndReturn(foo.Bar.Text, "foo"); // <-- error
}
Assert.AreEqual("foo", new Foo().Bar.Text);
MockManager.Verify();
}
Kept giving me a NullReferenceException (on the line marked with "<-- error"). Just to find out that Bar is a public field and NOT a property. :oops:
DON'T LET THIS HAPPEN TO YOU!
- Levi