Library Kata „INotifyPropertyChanged Tester“

Implement a library that can be used to verify that a class implements the INotifyPropertyChanged interface in a correct manner.

The interface INotifyPropertyChanged is used in data binding. The PropertyChanged event that is defined by the interface notifies its subscribers that a property of the object has changed its value. This mechanism is then used to update the visualization of the data in user interface controls.

An automated test for one property of a class that implements INotifyPropertyChanged typically looks like the following:

To create a test for each property of a class is cumbersome. Using the library to be implemented the test should look like the following example:

The type of the class under test should be given as a generic type parameter to the Verify method. The method creates an instance of the given class and searches for all public properties with getter and setter. These are the properties one has to implement the PropertyChanged event for. Next the method verifies that the properties raise the event if the getter is called. To be used in unit testing the Verify method has to throw an exception if a property does not implement the notification in a correct manner.