Explicit interface impl. cannot be mocked, they are not virtual 2009/7/23 Alexander Groß <[email protected]>
> > Hi all, > > While writing a unit test today I found that Rhino Mocks seems to mix > up properties of stubs that have expliclit interface implementations. > In my SUT I set these properties after casting the stub (that has > multiple implementations of the same interface) to a specific > interface. It's pretty simple, see here for the code: > http://gist.github.com/150458 > > To reproduce: > 1. Debug the test above > 2. Add watch ((IDoSomethingWith<int>)doer).DoSomething > 3. Add watch ((IDoSomethingWith<string>)doer).DoSomething > 4. Set a breakpoint to ((IDoSomethingWith<int>)doer).DoSomething > += .... > 5. Run to the breakpoint > 6. Step over the breakpoint and note that: > a) ((IDoSomethingWith<int>)doer).DoSomething is set > b) ((IDoSomethingWith<string>)doer).DoSomething throws an > InvalidCastException > 7. The second assignment in the ctor will fail the test > > I would like to know if that is intended behavior. If it's not (the > code runs fine in scenarios without stubs), please consider my patch: > http://gist.github.com/150466 > > Thanks, > > Alex > > X-Post from rhino-tools-dev > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/RhinoMocks?hl=en -~----------~----~----~----~------~----~------~--~---
