public override void SetUp()
        {
            base.SetUp();

            _definition = Configuration.GetTypeDefinition(typeof(Customer)).GetRelationEndPointDefinition(typeof(Customer).FullName + ".Orders");

            _virtualEndPointMock = MockRepository.GenerateStrictMock <IVirtualEndPoint <object> > ();
            _dataManagerMock     = MockRepository.GenerateStrictMock <IVirtualEndPointDataManager>();
            _dataManagerMock.Stub(stub => stub.EndPointID).Return(RelationEndPointID.Create(DomainObjectIDs.Customer1, _definition));
            _endPointProviderStub         = MockRepository.GenerateStub <IRelationEndPointProvider>();
            _transactionEventSinkWithMock = MockRepository.GenerateStrictMock <IClientTransactionEventSink>();

            _loadState = new TestableCompleteVirtualEndPointLoadState(_dataManagerMock, _endPointProviderStub, _transactionEventSinkWithMock);

            _relatedObject       = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order1);
            _relatedEndPointStub = MockRepository.GenerateStub <IRealObjectEndPoint>();
            _relatedEndPointStub.Stub(stub => stub.GetDomainObjectReference()).Return(_relatedObject);
            _relatedEndPointStub.Stub(stub => stub.ObjectID).Return(_relatedObject.ID);
        }
        public void FlattenedSerializable()
        {
            var state = new TestableCompleteVirtualEndPointLoadState(
                new SerializableVirtualEndPointDataManagerFake(),
                new SerializableRelationEndPointProviderFake(),
                new SerializableClientTransactionEventSinkFake());

            var oppositeEndPoint = new SerializableRealObjectEndPointFake(null, _relatedObject);

            AddUnsynchronizedOppositeEndPoint(state, oppositeEndPoint);

            var result = FlattenedSerializer.SerializeAndDeserialize(state);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.DataManager, Is.Not.Null);
            Assert.That(result.EndPointProvider, Is.Not.Null);
            Assert.That(result.TransactionEventSink, Is.Not.Null);
            Assert.That(result.UnsynchronizedOppositeEndPoints.Count, Is.EqualTo(1));
        }