http://ayende.com/wiki/Rhino+Mocks+3.5.ashx#Howtoraiseevents

On Thu, Dec 11, 2008 at 9:01 PM, Berryl Hesh <[email protected]> wrote:

>
> I have a ButtonWidgetClass that implements an IButton interface. If
> the implemented class is constructed with an ICommand, then that
> command should be executed when Click is invoked. So I can't just test
> the interface that I can see. Can Rhino invoke the event?
>
> Thanks! Berryl
>
>
> public interface IButton
>  {
>    event EventHandler Click;
>    ICommand Command { get; set; }
> }
>
> public class ButtonWidgetBase : IButton
> {
>    public event EventHandler Click;
>    protected virtual void OnClick(object sender, EventArgs e) { if
> (Click != null) Click(sender, e); }
>
>    public ICommand Command { get; set; }
>
>    public ButtonWidgetBase(ICommand command) {
>                Command = command;
>                Click += (sender, e) => Command.Execute(e);
>            }
>    }
>
> >
>

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