コード例 #1
0
 public void PropertyValueChange_CallsBoth()
 {
     _changedProperty = new NotificationData();
     _changingProperty = new NotificationData();
     //setup
     CheckNotification not = new CheckNotification();
     not.PropertyChanged += new PropertyChangedEventHandler(ChangedName);
     not.PropertyChanging += new PropertyChangingEventHandler(ChangingName);
     //act
     not.Name = "Test";
     //assert
     Assert.That(_changingProperty.PropertyName, new EqualConstraint("Name"));
     Assert.That(_changedProperty.PropertyName, new EqualConstraint("Name"));
     Assert.That(_changingProperty.PropertyValue, new EqualConstraint(null));
     Assert.That(_changedProperty.PropertyValue, new EqualConstraint("Test"));
     Assert.That(_changingProperty.TimeOfCall, new LessThanConstraint(_changedProperty.TimeOfCall), "First changing must be called, afterwards changed");
 }
コード例 #2
0
 public void PropertyValueMatchesPrev_NoCall()
 {
     _changedProperty = new NotificationData();
     _changingProperty = new NotificationData();
     //setup
     CheckNotification not = new CheckNotification();
     not.Name = "Test";
     not.PropertyChanging += new PropertyChangingEventHandler(ChangingName);
     not.PropertyChanged += new PropertyChangedEventHandler(ChangedName);
     //act
     not.Name = "Test";
     //assert
     Assert.That(_changingProperty.PropertyName, new EqualConstraint(null));
     Assert.That(_changedProperty.PropertyName, new EqualConstraint(null));
     Assert.That(_changingProperty.PropertyValue, new EqualConstraint(null));
     Assert.That(_changedProperty.PropertyValue, new EqualConstraint(null));
     Assert.That(_changedProperty.TimeOfCall, new EqualConstraint(0));
     Assert.That(_changingProperty.TimeOfCall, new EqualConstraint(0));
 }