private void CheckOppositeObjectNullSetter(ObjectEndPointDeleteCommand command)
        {
            var setter = (Action)PrivateInvoke.GetNonPublicField(command, "_oppositeObjectNullSetter");

            _dataManagerMock.BackToRecord();
            _dataManagerMock.Expect(mock => mock.CurrentOppositeObject = null);
            _dataManagerMock.Replay();

            setter();

            _dataManagerMock.VerifyAllExpectations();
        }
        public override void SetUp()
        {
            base.SetUp();

            _endPointID   = RelationEndPointObjectMother.CreateRelationEndPointID(DomainObjectIDs.Order1, "OrderTicket");
            _endPoint     = RelationEndPointObjectMother.CreateObjectEndPoint(_endPointID, DomainObjectIDs.OrderTicket1);
            _domainObject = _endPoint.GetDomainObject();

            _oppositeObjectNullSetterCalled = false;
            _oppositeObjectNullSetter       = () =>
            {
                _oppositeObjectNullSetterCalled = true;
            };

            _transactionEventSinkWithMock = MockRepository.GenerateStrictMock <IClientTransactionEventSink>();
            _command = new ObjectEndPointDeleteCommand(_endPoint, _oppositeObjectNullSetter, _transactionEventSinkWithMock);
        }
Exemplo n.º 3
0
        public IDataManagementCommand CreateDeleteCommand(IRealObjectEndPoint endPoint, Action oppositeObjectNullSetter)
        {
            ArgumentUtility.CheckNotNull("endPoint", endPoint);
            ArgumentUtility.CheckNotNull("oppositeObjectNullSetter", oppositeObjectNullSetter);

            var oppositeEndPointDefinition = endPoint.Definition.GetOppositeEndPointDefinition();

            var objectEndPointDeleteCommand = new ObjectEndPointDeleteCommand(endPoint, oppositeObjectNullSetter, _transactionEventSink);

            if (!oppositeEndPointDefinition.IsAnonymous && oppositeEndPointDefinition.IsVirtual)
            {
                var oldRelatedEndPoint = GetOppositeEndPoint(endPoint, endPoint.OppositeObjectID);
                var newRelatedEndPoint = GetOppositeEndPoint(endPoint, null);
                return(new RealObjectEndPointRegistrationCommandDecorator(objectEndPointDeleteCommand, endPoint, oldRelatedEndPoint, newRelatedEndPoint));
            }
            else
            {
                return(objectEndPointDeleteCommand);
            }
        }
 private Action GetOppositeObjectNullSetter(ObjectEndPointDeleteCommand command)
 {
     return((Action)PrivateInvoke.GetNonPublicField(command, "_oppositeObjectNullSetter"));
 }