コード例 #1
0
        public void InTest_PropertyValueChange_CallsBoth()
        {
            _changedProperty  = new NotificationData();
            _changingProperty = new NotificationData();
            //setup
            CheckNotificationInTest not = new CheckNotificationInTest();

            not.PropertyChanged  += new PropertyChangedEventHandler(ChangedNameLocal);
            not.PropertyChanging += new PropertyChangingEventHandler(ChangingNameLocal);
            //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));
        }
コード例 #3
0
 private void ChangedNameLocal(object sender, PropertyChangedEventArgs e)
 {
     this._changedProperty = new NotificationData(e.PropertyName, ((CheckNotificationInTest)sender).Name);
 }
コード例 #4
0
 private void ChangingName(object sender, PropertyChangingEventArgs e)
 {
     this._changingProperty = new NotificationData(e.PropertyName, ((CheckNotification)sender).Name);
 }
コード例 #5
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");
 }
コード例 #6
0
 private void ChangedNameLocal(object sender, PropertyChangedEventArgs e)
 {
     this._changedProperty = new NotificationData(e.PropertyName, ((CheckNotificationInTest)sender).Name);
 }
コード例 #7
0
 private void ChangingName(object sender, PropertyChangingEventArgs e)
 {
     this._changingProperty = new NotificationData(e.PropertyName, ((CheckNotification)sender).Name);
 }
コード例 #8
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));
 }