|
From: Steve F. <st...@m3...> - 2004-07-28 19:43:11
|
Ouch. Well one option might be to create another interface that extends
both and mock that. I can't try it on my current setup so you'll have to
experiment. You /sure/ you can't change the type structure?
S.
Nick Robinson wrote:
> I am mocking an interface, and inside the client class I need to do a query
> for a different type:
>
> Client(ISomeInterface someInterface)
> {
> INewInterface interface = someInterface as IAnotherInterface;
> if(interface != null)
> {
> ...
> }
> }
>
> someInterface is a mock. The only way I know how to work with this is to
> stub the interface rather than mock it - I cannot move away from the
> downcast. Is it possible to do this on a mock? I get the feeling I would
> need to do something like:
>
> DynamicMock someInterfaceMock = new DynamicMock(typeof(ISomeInterface));
> someInterfaceMock.Supports(typeof(IAnotherInterface));
|