You're better of if you split your implementation> Have a
IRequestCreator factory class, which creates the instances of Class1,
class2, etc.
Your SendMessage method will have this non-generic signature:
public void SendMessage(IRequest reply);
Then, your previous code will look like:
var myRequest = requestCreator.Create(typeof(xxxx));
if (myRequest != null)
{
SendMessage(myRequest);
}
Now, you can mock requestCreator, make it return null on certain
condition, and test that SendMessage was not called.
And another group of tests, to test the actual creator, and make sure
it returns actual instance or null, when needed.
Cheers
> --
> You received this message because you are subscribed to the Google Groups
> "Rhino.Mocks" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/rhinomocks/-/x-12icZMwnYJ.
> To post to this group, send email to
rhino...@googlegroups.com.
> To unsubscribe from this group, send email to
>
rhinomocks+...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/rhinomocks?hl=en.
--
Svetoslav Milenov (Sunny)
Artificial Intelligence is no match for natural stupidity.