Note that there are some explanatory texts on larger screens.

plurals
  1. POWhere is the MOQ documentation?
    text
    copied!<p>Where can I find comprehensive documentation for MOQ? I'm just starting with mocking and am having difficulty getting my head around it. I've read through all the links at <a href="http://code.google.com/p/moq/wiki/QuickStart" rel="nofollow noreferrer">http://code.google.com/p/moq/wiki/QuickStart</a> but can't seem to find a tutorial or gentle introduction.</p> <p>I have also looked briefly at Rhino Mocks but found it very confusing.</p> <hr> <p>Yes - I read Stephen Walthers article - very helpful. I also went through the links. I can't seem to watch the video at <strike><a href="http://www.bestechvideos.com/2008/06/08/dimecasts-net-introduction-to-mocking-with-moq" rel="nofollow noreferrer">http://www.bestechvideos.com/2008/06/08/dimecasts-net-introduction-to-mocking-with-moq</a></strike> <sup>[broken link]</sup></p> <p>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 <code>EventHandler&lt;TEventArgs&gt;</code>, but even then I can't get the code to compile.</p> <p>More specifically I have a class that implements <code>INotifyChanged</code>. </p> <pre><code>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 ..... } </code></pre> <p>How do I mock the class to test whether the <code>PropertyChanged</code> event was fired? I can't rewrite the event to <code>public event EventHandler&lt;PropertyChangedEventArgs&gt;</code> becuase I get this error:</p> <blockquote> <p>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'.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload