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 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));
        }
        public void FlattenedSerializable()
        {
            var changeDetectionStrategy = new SerializableCollectionEndPointChangeDetectionStrategyFake();
            var data = new CollectionEndPointDataManager(_endPointID, changeDetectionStrategy);

            var endPointFake = new SerializableRealObjectEndPointFake(null, _domainObject1);

            data.RegisterOriginalOppositeEndPoint(endPointFake);
            data.RegisterOriginalItemWithoutEndPoint(_domainObject2);

            var deserializedInstance = FlattenedSerializer.SerializeAndDeserialize(data);

            Assert.That(deserializedInstance.EndPointID, Is.Not.Null);
            Assert.That(deserializedInstance.ChangeDetectionStrategy, Is.Not.Null);
            Assert.That(deserializedInstance.CollectionData.Count, Is.EqualTo(2));
            Assert.That(deserializedInstance.OriginalCollectionData.Count, Is.EqualTo(2));
            Assert.That(deserializedInstance.OriginalOppositeEndPoints.Length, Is.EqualTo(1));
            Assert.That(deserializedInstance.OriginalItemsWithoutEndPoints.Length, Is.EqualTo(1));
            Assert.That(deserializedInstance.CurrentOppositeEndPoints.Length, Is.EqualTo(1));
        }
Exemplo n.º 4
0
        public void FlattenedSerializable()
        {
            var endPointLoader = new SerializableVirtualEndPointLoaderFake <
                ICollectionEndPoint,
                ReadOnlyCollectionDataDecorator,
                ICollectionEndPointDataManager,
                ICollectionEndPointLoadState> ();
            var dataManagerFactory = new SerializableCollectionEndPointDataManagerFactoryFake();

            var state = new IncompleteCollectionEndPointLoadState(endPointLoader, dataManagerFactory);

            var oppositeEndPoint = new SerializableRealObjectEndPointFake(null, _relatedObject);

            state.RegisterOriginalOppositeEndPoint(_collectionEndPointMock, oppositeEndPoint);

            var result = FlattenedSerializer.SerializeAndDeserialize(state);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.OriginalOppositeEndPoints, Is.Not.Null);
            Assert.That(result.OriginalOppositeEndPoints, Is.Not.Empty);
            Assert.That(result.EndPointLoader, Is.Not.Null);
            Assert.That(result.DataManagerFactory, Is.Not.Null);
        }
Exemplo n.º 5
0
        public void FlattenedSerializable()
        {
            var endPointLoader =
                new SerializableVirtualEndPointLoaderFake <
                    IVirtualEndPoint <object>,
                    object,
                    IVirtualEndPointDataManager,
                    IVirtualEndPointLoadState <IVirtualEndPoint <object>, object, IVirtualEndPointDataManager> >();

            var state = new TestableIncompleteVirtualEndPointLoadState(endPointLoader);

            var oppositeEndPoint = new SerializableRealObjectEndPointFake(
                null,
                DomainObjectMother.CreateFakeObject <OrderTicket> (DomainObjectIDs.OrderTicket1));

            state.RegisterOriginalOppositeEndPoint(_virtualEndPointMock, oppositeEndPoint);

            var result = FlattenedSerializer.SerializeAndDeserialize(state);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.OriginalOppositeEndPoints, Is.Not.Null);
            Assert.That(result.OriginalOppositeEndPoints, Is.Not.Empty);
            Assert.That(result.EndPointLoader, Is.Not.Null);
        }