Hello,
I'm new to Rhino Mocks and I'm trying to mock an event. I found many
blogs where it was explained on MVP model but I didn't find what I
need.
I try ti check if an event was fired after o property was setted.
Heres my class ( part of it):
public delegate void TranslationEventHandler(ITranslation sender,
ChangeBoolValueEventArgs args);
public abstract class Translation : ITranslation
{
public event TranslationEventHandler InitialTranslationChanged;
public Translation()
{
this.Language = new Language();
this.IsInitialTranslation = true;
this.Enabled = true;
}
public virtual bool IsInitialTranslation
{
get { return isInitialTranslation; }
set
{
if (InitialTranslationChanged != null &&
this.isInitialTranslation !
= value)
InitialTranslationChanged(this, new
ChangeBoolValueEventArgs
(this.isInitialTranslation, value));
isInitialTranslation = value;
}
}
Here's my test:
[Test]
public void IsInitialTranslation_SettingProperty_EventIsRised()
{
bool eventFired = false;
translation.InitialTranslationChanged += delegate
{ eventFired = true; };
translation.IsInitialTranslation = false;
Assert.IsTrue(eventFired);
}
The problem is that eventFired is always False.
What I'm doing wrong ?
Thanks for your help.
TJA
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---