mercredi 18 février 2015

mocking method with an array arggument wich will change after call

i have an issue with mocking method call with reference argument (byte[]) that will change after the call :



private Mock<ISocket> mSocket;
byte[] buffer = new byte[1000];
mSocket.Expects.One.Method(x => x.Receive(null))
.With(buffer).WillReturn(2);


but after the call , i need to have buffer data changed .



buffer[0] = 10;
buffer[1] = 20;


how can i mock this behavior without changing production code.


thanks,


Aucun commentaire:

Enregistrer un commentaire