Rhino Mocks EventsTwisting the Syntax
Okay, so Aaron Jensen has suggest an alternative syntax to this (which I don't like, since it has strings):
It is this:
Basically, it is reversing the syntax a bit, since it is actually the "register to event" syntax, but we can use that to raise events in a fairly natural way, without resorting to strings.
I am not sure if the sytnax is clear enough, so I wanted to ask, what would you rather have?
More posts in "Rhino Mocks Events" series:
- (09 Jun 2007) Twisting the Syntax
- (08 Jun 2007) Purity vs. Practicality
Comments
Isn't it possible to do EventRaiser.GetRaiser(obj.Bar)? where GetRaiser takes in a MultiCast Delegate?
Roy,
Much as I would like it to be this way, the compiler will give an error on this code.
Roy,
Much as I would like it to be this way, the compiler will give an error on this code.
Roy,
Much as I would like it to be this way, the compiler will give an error on this code.
Roy,
Much as I would like it to be this way, the compiler will give an error on this code.
Another annoyance that some people raise is having to hook up a null to the rest of the events, even the ones that we are not interested in.
That's what dynamic mocks are for.
Can you explain it again?
Sorry Ayende, I was referring to the comment by @Adam. Complaining about having to wire up the expectation of handling other events to null. I believe it was a comment to the mocking framework in general. The solution to this, of course, is to use dynamic mocks to setup expectations to the specific test case in hand.
Comment preview