I have a method that calls another method of a mocked object with a parameter that is calculated according to the parameters that I passed to my tested function.
How do I verify that the method my tested method is calling is called correctly.
I am using Moq.
EDIT:
As none of you get what I mean (or as I do not understand the fact that you guys solved the problem for me) I'll be more concreate.
I have the following method signature:
IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state);
Inside it should instantiate a SocketAsyncEventArgs object and call it's SetBuffer method with the right SocketAsyncEventArgs.
The SocketAsyncEventArgs is an implementation detail, but it is however the only way to implement the feature I am after so I have to check if it's SetBuffer method is called correctly.
How do I make sure that the BeginWrite() implementation does actually call SetBuffer with the right parameters?
Edit 2:
Here's some code to clarify what I mean:
public IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
{
// No mocking can be done here
SocketAsyncEventArgs args = new SocketAsyncEventArgs
{
// Proper initialization. Should be verified as well.
};
args.SetBuffer(buffer, offset, size);
Client.SendAsync(args);
}