Yes - I read Stephen Walthers article - very helpful. I also went through the links. I can't seem to watch the video at http://www.bestechvideos.com/2008/06/08/dimecasts-net-introduction-to-mocking-with-moq
Specifically I am trying to determine whether an event was raised from the mocked class. I can't get the example for events on the QuickStarts page to compile. On the google groups, Daniel explained that CreateEventHandler can only handle an event of type EventHandler, but even then I can't get the code to compile.
More specifically I have a class that implements INotifyChanged.
public class Entity : INotifyChanged
{
public event PropertyChangingEventHandler PropertyChanging;
public int Id
{
get {return _id;}
set {
_id = value;
OnPropertyChanged("Id");
}
}
protected void OnPropertyChanged(string property)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
etc .....
}
How do I mock the class to test whether the PropertyChanged event was fired? I can't rewrite the event to public event EventHandler becuase I get this error:
Error 1 'CoreServices.Notifier' does not implement interface member System.ComponentModel.INotifyPropertyChanged.PropertyChanged'. 'CoreServices.Notifier.PropertyChanged' cannot implement 'System.ComponentModel.INotifyPropertyChanged.PropertyChanged' because it does not have the matching return type of 'System.ComponentModel.PropertyChangedEventHandler'.