public static void Main() { var pcc = new PropertyChangedClass(); pcc.PropertyChanged += Pcc_PropertyChanged; pcc.Indice = 10; }
public void OnPropertyChanged_NotExistPropertyTest() { var firedList = new List <string>(); var item = new PropertyChangedClass(); item.PropertyChanged += (sender, args) => firedList.Add(args.PropertyName); item.ManualInternalFire("NotExistProperty"); Assert.That(firedList.Count, Is.EqualTo(1)); Assert.That(firedList[0], Is.EqualTo("NotExistProperty")); }
public void Property_PropertyChangedAlsoTest() { var firedList = new List <string>(); var item = new PropertyChangedClass(); item.PropertyChanged += (sender, args) => firedList.Add(args.PropertyName); item.Property1 = "Fire!!"; Assert.That(firedList.Count, Is.EqualTo(3)); Assert.That(firedList.Contains(nameof(item.Property1)), Is.True); Assert.That(firedList.Contains("NotExistProperty"), Is.True); Assert.That(firedList.Contains(nameof(item.Property2)), Is.True); }