コード例 #1
0
        public override void SetUp()
        {
            base.SetUp();

            _domainObject     = DomainObjectIDs.Order1.GetObject <Order> ();
            _oldRelatedObject = DomainObjectIDs.OrderTicket1.GetObject <OrderTicket> ();
            _newRelatedObject = DomainObjectIDs.OrderTicket2.GetObject <OrderTicket> ();

            _endPointID = RelationEndPointID.Resolve(_domainObject, o => o.OrderTicket);
            _endPoint   = RelationEndPointObjectMother.CreateObjectEndPoint(_endPointID, _oldRelatedObject.ID);

            _command = new ObjectEndPointSetOneOneCommand(_endPoint, _newRelatedObject, OppositeObjectSetter, TransactionEventSinkWithMock);
        }
        public override void SetUp()
        {
            base.SetUp();

            _domainObject     = DomainObjectIDs.Client3.GetObject <Client> ();
            _oldRelatedObject = DomainObjectIDs.Client1.GetObject <Client> ();
            _newRelatedObject = DomainObjectIDs.Client2.GetObject <Client> ();

            _endPointID = RelationEndPointID.Resolve(_domainObject, c => c.ParentClient);
            _endPoint   = RelationEndPointObjectMother.CreateObjectEndPoint(_endPointID, _oldRelatedObject.ID);

            _command = new ObjectEndPointSetUnidirectionalCommand(_endPoint, _newRelatedObject, OppositeObjectSetter, TransactionEventSinkWithMock);
        }
        public override void SetUp()
        {
            base.SetUp();

            _domainObject     = DomainObjectIDs.OrderItem1.GetObject <OrderItem>();
            _oldRelatedObject = _domainObject.Order;
            _newRelatedObject = DomainObjectIDs.Order3.GetObject <Order> ();

            _endPointID = RelationEndPointID.Resolve(_domainObject, oi => oi.Order);
            _endPoint   = (RealObjectEndPoint)RelationEndPointObjectMother.CreateObjectEndPoint(_endPointID, _oldRelatedObject.ID);

            _command = new ObjectEndPointSetOneManyCommand(_endPoint, _newRelatedObject, OppositeObjectSetter, EndPointProviderStub, TransactionEventSinkWithMock);
        }
        private void CheckOppositeObjectIDSetter(ObjectEndPointSetCommand command)
        {
            var setter = (Action <DomainObject>)PrivateInvoke.GetNonPublicField(command, "_oppositeObjectSetter");

            var newRelatedObject = DomainObjectMother.CreateFakeObject <OrderTicket> ();

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

            setter(newRelatedObject);

            _dataManagerMock.VerifyAllExpectations();
        }
 private Action <DomainObject> GetOppositeObjectIDSetter(ObjectEndPointSetCommand command)
 {
     return((Action <DomainObject>)PrivateInvoke.GetNonPublicField(command, "_oppositeObjectSetter"));
 }