Glad I could help! :-)
On Tue, Nov 4, 2008 at 9:41 AM, chrissie1 <[EMAIL PROTECTED]> wrote:
>
> Oops, Stupid me. I found it. This works.
>
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using Rhino.Mocks;
>
> namespace ConsoleApplication2
> {
> [NUnit.Framework.TestFixture]
> public class Program
> {
> static void Main(string[] args)
> {
> var toThrow = new ToThrow();
> ICatchThrow catchThrow = new CatchThrow();
> toThrow.throwevent += catchThrow.catchthrow;
> toThrow.voidthrowingevent("");
> }
>
> public delegate void mydelegate(string param);
>
> public class ToThrow
> {
> public event mydelegate throwevent;
>
> public void voidthrowingevent(string param)
> {
> throwevent(param);
> }
> }
>
> public class CatchThrow : ICatchThrow
> {
> public void catchthrow(string param)
> {
> Console.WriteLine("Thrown" + param);
> Console.ReadLine();
> }
> }
>
> public interface ICatchThrow
> {
> void catchthrow(string param);
> }
>
> [NUnit.Framework.Test]
> public void Test_If_Event_Gets_Thrown()
> {
> var toThrow = new ToThrow();
> var catchThrow =
> MockRepository.GenerateStub<ICatchThrow>();
> toThrow.throwevent += catchThrow.catchthrow;
> toThrow.voidthrowingevent("");
> catchThrow.AssertWasCalled(e => e.catchthrow(""));
> }
> }
> }
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---