I am writing a test to see if my class reacts correctly to an event (and mind you, I just started TDD, so bear with me).
The class I want to test against registers an event handler:
class MyClass {
public MyClass(INotifyPropertyChanged propertyChanged) {
propertyChanged.PropertyChanged += MyHandler;
}
}
and my test looks something like this (this is where I am stuck):
[TestMethod]
public void MyClass_ShouldHandleEventCorrectly() {
// Arrange
MyClass myClass = new MyClass();
// Act (this obviously doesn't work ....)
myClass.PropertyChanged.Invoke()
// Assert
}