Example #1
0
        public void SetDataFromSubTransaction_InvalidDefinition()
        {
            var            otherID = RelationEndPointObjectMother.CreateRelationEndPointID(DomainObjectIDs.OrderTicket1, "Order");
            ObjectEndPoint source  = RelationEndPointObjectMother.CreateRealObjectEndPoint(otherID);

            _endPointPartialMock.SetDataFromSubTransaction(source);
        }
Example #2
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);
        }
Example #3
0
        public override void SetUp()
        {
            base.SetUp();

            _domainObject  = DomainObjectIDs.Computer1.GetObject <Computer> ();
            _relatedObject = DomainObjectIDs.Employee3.GetObject <Employee> ();

            _endPointID = RelationEndPointID.Resolve(_domainObject, c => c.Employee);
            _endPoint   = RelationEndPointObjectMother.CreateObjectEndPoint(_endPointID, _relatedObject.ID);
            _transactionEventSinkWithMock = MockRepository.GenerateStrictMock <IClientTransactionEventSink>();

            _command = new ObjectEndPointSetSameCommand(_endPoint, _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);
        }
Example #5
0
        public void SetDataFromSubTransaction_NoTouching_IfNothingHappened()
        {
            var            sourceID = RelationEndPointID.Create(DomainObjectIDs.OrderItem2, _endPointID.Definition);
            ObjectEndPoint source   = RelationEndPointObjectMother.CreateObjectEndPoint(sourceID, DomainObjectIDs.OrderTicket1);

            Assert.That(source.HasBeenTouched, Is.False);

            _endPointPartialMock.Stub(stub => stub.OppositeObjectID).Return(DomainObjectIDs.OrderTicket1);
            _endPointPartialMock.Stub(stub => stub.HasBeenTouched).Return(false);
            _endPointPartialMock.Stub(stub => stub.HasChanged).Return(false);
            _endPointPartialMock.Stub(stub => stub.CallSetOppositeObjectDataFromSubTransaction(source));
            _endPointPartialMock.Replay();

            _endPointPartialMock.SetDataFromSubTransaction(source);

            _endPointPartialMock.AssertWasNotCalled(mock => mock.Touch());
        }
        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);
        }
Example #7
0
        public void SetDataFromSubTransaction_TouchesEndPoint_IfSourceWasTouched()
        {
            var            sourceID = RelationEndPointID.Create(DomainObjectIDs.OrderItem2, _endPointID.Definition);
            ObjectEndPoint source   = RelationEndPointObjectMother.CreateObjectEndPoint(sourceID, DomainObjectIDs.OrderTicket2);

            source.Touch();
            Assert.That(source.HasBeenTouched, Is.True);

            _endPointPartialMock.Stub(stub => stub.OppositeObjectID).Return(DomainObjectIDs.OrderTicket1);
            _endPointPartialMock.Stub(stub => stub.HasBeenTouched).Return(false);
            _endPointPartialMock.Stub(stub => stub.CallSetOppositeObjectDataFromSubTransaction(source));
            _endPointPartialMock.Expect(mock => mock.Touch());
            _endPointPartialMock.Replay();

            _endPointPartialMock.SetDataFromSubTransaction(source);

            _endPointPartialMock.VerifyAllExpectations();
        }