public override void Check(ChangeState expectedState)
        {
            base.Check(expectedState);

            PropertyChangeState propertyChangeState = (PropertyChangeState)expectedState;

            if (_propertyDefinition != propertyChangeState.PropertyDefinition)
            {
                throw CreateApplicationException(
                          "Actual PropertyName '{0}' and expected PropertyName '{1}' do not match.",
                          _propertyDefinition.PropertyName,
                          propertyChangeState.PropertyDefinition.PropertyName);
            }

            if (!Equals(_oldValue, propertyChangeState.OldValue))
            {
                throw CreateApplicationException(
                          "Actual old value '{0}' and expected old value '{1}' do not match.",
                          _oldValue,
                          propertyChangeState.OldValue);
            }

            if (!Equals(_newValue, propertyChangeState.NewValue))
            {
                throw CreateApplicationException(
                          "Actual new value '{0}' and expected new value '{1}' do not match.",
                          _newValue,
                          propertyChangeState.NewValue);
            }
        }
        public override void Check(ChangeState expectedState)
        {
            base.Check(expectedState);

            CollectionChangeState collectionChangeState = (CollectionChangeState)expectedState;

            if (!ReferenceEquals(_domainObject, collectionChangeState.DomainObject))
            {
                throw CreateApplicationException(
                          "Affected actual DomainObject '{0}' and expected DomainObject '{1}' do not match.",
                          _domainObject.ID,
                          collectionChangeState.DomainObject.ID);
            }
        }
예제 #3
0
        public virtual void Check(ChangeState expectedState)
        {
            ArgumentUtility.CheckNotNull("expectedState", expectedState);

            if (this.GetType() != expectedState.GetType())
            {
                throw CreateApplicationException(
                          "Type of actual state '{0}' does not match type of expected state '{1}'.",
                          this.GetType(),
                          expectedState.GetType());
            }

            if (!ReferenceEquals(_sender, expectedState.Sender))
            {
                throw CreateApplicationException(
                          "Actual sender '{0}' does not match expected sender '{1}'.", _sender, expectedState.Sender);
            }
        }