I am getting this error when I try to set a mock to have PropertyBehavior()
:
System.InvalidOperationException: System.InvalidOperationEx
I think you have to do MockRepository.ReplyAll() after you set up all expectations and before you start using this mock. So my guess in your case is that you have to move the Expect.Call line before mediator = new AddAddressMediator(form);, and stick the reply all right after that:
[TestInitialize()]
public void MyTestInitialize()
{
form = MockRepository.GenerateMock();
// Make the properties work like a normal property
Expect.Call(form.OKButtonEnabled).PropertyBehavior();
//I tried this too. I still get the exception
//SetupResult.For(form.OKButtonEnabled).PropertyBehavior();
MockRepository.ReplyAll();
mediator = new AddAddressMediator(form);
}