I tried to build a fake socket for testing using the following code:
var socket = MockRepository.GenerateStub<Socket>(
AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.IP
);
socket.Stub(v => v.RemoteEndPoint).PropertyBehavior().Return(
new IPEndPoint(IPAddress.Parse("127.0.0.1"), 12345)
);
However, the attempt to create the stub for the read only-property gives me the following exception:
Invalid call, the last call has been used or no call has been made (make sure that you are calling a virtual (C#) / Overridable (VB) method).
Could anyone help me spot where it's going wrong?
Thanks