爲了讓NUnit測試中的PropertyChanged觸發,我必須設置ShouldAlwaysRaiseInpcOnUserInterfaceThread(false)。當我稍後將該類用作ViewModel時,是否會對此產生影響?也許我應該在NUnit中設置一個用戶界面線程?幫幫我!使用MvxNotifyPropertyChanged作爲替代實現INotifyPropertyChanged是否安全?
public interface ISomething : INotifyPropertyChanged
{
}
public class Something : MvxNotifyPropertyChanged, ISomething
{
public Something()
{
ShouldAlwaysRaiseInpcOnUserInterfaceThread(false);
}
private int _num;
public int Num
{
get { return _num; }
set { if (_num != value) { _num = value; RaisePropertyChanged(() => Num); }
}
}