public void FlattenedSerializable()
        {
            var data = new VirtualObjectEndPointDataManager(_endPointID);

            var endPointFake = new SerializableRealObjectEndPointFake(null, DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order1));

            data.RegisterOriginalOppositeEndPoint(endPointFake);

            var deserializedInstance = FlattenedSerializer.SerializeAndDeserialize(data);

            Assert.That(deserializedInstance.EndPointID, Is.Not.Null);
            Assert.That(deserializedInstance.OriginalOppositeEndPoint, Is.Not.Null);
            Assert.That(deserializedInstance.OriginalOppositeObject, Is.Not.Null);
            Assert.That(deserializedInstance.CurrentOppositeEndPoint, Is.Not.Null);
            Assert.That(deserializedInstance.CurrentOppositeObject, Is.Not.Null);
        }
        public void SetDataFromSubTransaction_Null()
        {
            _dataManager.CurrentOppositeObject = _oppositeObject;
            _dataManager.RegisterCurrentOppositeEndPoint(_oppositeEndPointStub);

            var sourceDataManager = new VirtualObjectEndPointDataManager(_endPointID);

            Assert.That(sourceDataManager.CurrentOppositeObject, Is.Null);
            Assert.That(sourceDataManager.CurrentOppositeEndPoint, Is.Null);
            var endPointProviderStub = MockRepository.GenerateStub <IRelationEndPointProvider> ();

            _dataManager.SetDataFromSubTransaction(sourceDataManager, endPointProviderStub);

            Assert.That(_dataManager.CurrentOppositeObject, Is.Null);
            Assert.That(_dataManager.CurrentOppositeEndPoint, Is.Null);
        }
        public override void SetUp()
        {
            base.SetUp();

            _endPointID = RelationEndPointObjectMother.CreateRelationEndPointID(DomainObjectIDs.Order1, "OrderTicket");

            _dataManager = new VirtualObjectEndPointDataManager(_endPointID);

            _oppositeObject       = DomainObjectMother.CreateFakeObject <OrderTicket> (DomainObjectIDs.OrderTicket1);
            _oppositeEndPointStub = MockRepository.GenerateStub <IRealObjectEndPoint> ();
            _oppositeEndPointStub.Stub(stub => stub.GetDomainObjectReference()).Return(_oppositeObject);

            _oppositeObject2       = DomainObjectMother.CreateFakeObject <OrderTicket> (DomainObjectIDs.OrderTicket2);
            _oppositeEndPointStub2 = MockRepository.GenerateStub <IRealObjectEndPoint> ();
            _oppositeEndPointStub2.Stub(stub => stub.GetDomainObjectReference()).Return(_oppositeObject2);
        }
        public void SetDataFromSubTransaction()
        {
            var sourceOppositeEndPointStub = MockRepository.GenerateStub <IRealObjectEndPoint>();

            sourceOppositeEndPointStub.Stub(stub => stub.ID).Return(_oppositeEndPointStub.ID);

            var sourceDataManager = new VirtualObjectEndPointDataManager(_endPointID);

            sourceDataManager.CurrentOppositeObject = _oppositeObject;
            sourceDataManager.RegisterCurrentOppositeEndPoint(sourceOppositeEndPointStub);

            var endPointProviderStub = MockRepository.GenerateStub <IRelationEndPointProvider>();

            endPointProviderStub
            .Stub(stub => stub.GetRelationEndPointWithoutLoading(sourceOppositeEndPointStub.ID))
            .Return(_oppositeEndPointStub);

            _dataManager.SetDataFromSubTransaction(sourceDataManager, endPointProviderStub);

            Assert.That(_dataManager.CurrentOppositeObject, Is.SameAs(_oppositeObject));
            Assert.That(_dataManager.CurrentOppositeEndPoint, Is.SameAs(_oppositeEndPointStub));
        }