I don't want to come across bigotted, preachy and omniscient -because
I'm really none of the above!- but my response here might be
interpreted in that way, and if that is the case, I apologise ahead of
it.

You are correct in your assertion of "...the dependency that you use
mock objects [in order] to avoid", however you can only use a tool
when it fits the purpose -which of course is why you are posting your
question here in the first place ...."does this tool fit my needs?" is
essentially what you are asking.

Here comes the preachy bit ....

I say "YES, this tool does fit your needs" ... but only if you are in
control of the codebase. This is my response because in my opinion
(which we have to remember is only one opinion, and given without full
knowledge of all the facts) is that the design under test is wrong.

It is pretty clear that the code was not developed in a test driven
manner -which in of itself does not make the design wrong, but it does
make the code difficult to test.
It is aso pretty clear that the code does not conform to the SRP
(Single Responsibility Principle), because MyController is also
concerned with some kind of Task and notifying concerned parties about
when this task is starting -this again makes the code difficult to
test.

My first instincts told me that MyController was actuall some kind of
UI Control object, but now I am coming to the conclusion that it is a
controller of the MVC ilk, which is somehow confused with the MVP
pattern. And I now call into question the presenter
implementation .... the Presenter really should not know anything
about the Controller -assuming that this is MVP with an overriding
Controller (again, just one opinion within a sea of such). ...

This has somehow turned into a code review, so I will desist, but I
think what I'm trying to say is that my belief is that the design of
your objects is wrong, and for this reason Rhino Mocks is not the tool
to use for testing them, instead you might be better off manually
constructing your own Mock implementations, instead of using auto-
generated mocks.

I don't mean to offend, or dictate so please treat this post as it was
intended (a constructive criticism, and a bunch of opinions)., thanks.



On Jan 29, 10:44 am, TheMightyKumquat <[email protected]> wrote:
> Yes - I know that I can't perform the cast - that's why I posted this
> in the first place. My question is - is there any way around this? Or
> is the answer just "no, you can't use Rhino Mocks to do this at all."
> The only thing I've been able to do to get my test to pass is to feed
> the real MyController object into the test as the Presenter's
> IMyController object. But that is exactly the dependency that you use
> mock objects to avoid!

-- 
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.

Reply via email to