I'm using FluentAssertions to check the view models. I would like to verify correctly raising PropertyChanged
events for the properties.
This is working fine when signaling individual properties:
public string MyName {
get => this.myName;
set => {
this.myName = value;
this.FirePropertyChanged(nameof(this.MyName));
}
}
...
sut.MonitorEvents();
sut.ShouldRaisePropertyChangeFor(model => model.MyName); // OK
Some complex view models wants to refresh all properties and raised null
or string.Empty
which causes the view to refresh (MSDN).
But the FluentAssertions call does not accept this as valid change.
public string IsServer {
get => this.isServer;
set => {
this.isServer = value;
this.FirePropertyChanged(string.Empty);
}
}
...
sut.MonitorEvents();
sut.ShouldRaisePropertyChangeFor(model => model.IsServer); // FAILED
Is there an option to check the events like this?