I have two questions.
- Does it make sense to test that an event will not be fired?
- If yes, what is the best way to accomplish that using the
xUnit
framework?
For example, I have a class with a single property Mark
,
public class Box : INotifyPropertyChanged
{
private Marking mark = Marking.None;
public Marking Mark
{
get
{
return mark;
}
set
{
mark = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Mark)));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
and I want to test that when someone is going to set the value of Mark
to the same value as the property points currently, then the PropertyChanged
event will not be fired.