This is the testcase (in C# I know) but it fails with this message
Rhino.Mocks.Exceptions.ExpectationViolationException:
ICatchThrow.catchthrow(""); Expected #1, Actual #0.
How can I make it not fail?
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()
{
throwevent("test");
}
}
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.GenerateMock<ICatchThrow>();
toThrow.throwevent += catchThrow.catchthrow;
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
-~----------~----~----~----~------~----~------~--~---