Exemplo n.º 1
0
        public void CollectionItems_Unsynchronized_WithUnload()
        {
            SetDatabaseModifyable();

            var order = DomainObjectIDs.Order1.GetObject <Order> ();

            order.OrderItems.EnsureDataComplete();

            var orderItemID = RelationInconcsistenciesTestHelper.CreateObjectAndSetRelationInOtherTransaction <OrderItem, Order> (order.ID, (oi, o) => oi.Order = o);
            var orderItem   = orderItemID.GetObject <OrderItem>();
            var endPointID  = RelationEndPointID.Resolve(orderItem, oi => oi.Order);
            var endPoint    = (RealObjectEndPoint)TestableClientTransaction.DataManager.GetRelationEndPointWithoutLoading(endPointID);

            Assert.That(endPoint, Is.Not.Null);

            Assert.That(RealObjectEndPointTestHelper.GetSyncState(endPoint), Is.TypeOf(typeof(UnsynchronizedRealObjectEndPointSyncState)));

            UnloadService.UnloadVirtualEndPoint(TestableClientTransaction, orderItem.Order.OrderItems.AssociatedEndPointID);

            Assert.That(RealObjectEndPointTestHelper.GetSyncState(endPoint), Is.TypeOf(typeof(UnknownRealObjectEndPointSyncState)));

            order.OrderItems.EnsureDataComplete();

            Assert.That(RealObjectEndPointTestHelper.GetSyncState(endPoint), Is.TypeOf(typeof(SynchronizedRealObjectEndPointSyncState)));
        }
        public void SyncState()
        {
            var deserializedEndPoint = FlattenedSerializer.SerializeAndDeserialize(_endPoint);

            var syncState = RealObjectEndPointTestHelper.GetSyncState(deserializedEndPoint);

            Assert.That(syncState, Is.Not.Null);
            Assert.That(syncState.GetType(), Is.SameAs(RealObjectEndPointTestHelper.GetSyncState(_endPoint).GetType()));
        }
        public void TouchedContent()
        {
            RealObjectEndPointTestHelper.SetOppositeObjectID(_endPoint, DomainObjectIDs.Employee1);

            var deserializedEndPoint = FlattenedSerializer.SerializeAndDeserialize(_endPoint);

            Assert.That(deserializedEndPoint.Definition, Is.SameAs(_endPoint.Definition));
            Assert.That(deserializedEndPoint.HasBeenTouched, Is.True);
            Assert.That(_endPoint.OppositeObjectID, Is.EqualTo(DomainObjectIDs.Employee1));
            Assert.That(_endPoint.OriginalOppositeObjectID, Is.EqualTo(DomainObjectIDs.Employee3));
        }
Exemplo n.º 4
0
        public void CollectionItems_Synchronized_WithUnload()
        {
            var orderItem  = DomainObjectIDs.OrderItem1.GetObject <OrderItem>();
            var endPointID = RelationEndPointID.Resolve(orderItem, oi => oi.Order);
            var endPoint   = (RealObjectEndPoint)TestableClientTransaction.DataManager.GetRelationEndPointWithoutLoading(endPointID);

            Assert.That(endPoint, Is.Not.Null);

            Assert.That(RealObjectEndPointTestHelper.GetSyncState(endPoint), Is.TypeOf(typeof(UnknownRealObjectEndPointSyncState)));

            orderItem.Order.OrderItems.EnsureDataComplete();

            Assert.That(RealObjectEndPointTestHelper.GetSyncState(endPoint), Is.TypeOf(typeof(SynchronizedRealObjectEndPointSyncState)));

            UnloadService.UnloadVirtualEndPoint(TestableClientTransaction, orderItem.Order.OrderItems.AssociatedEndPointID);

            Assert.That(RealObjectEndPointTestHelper.GetSyncState(endPoint), Is.TypeOf(typeof(UnknownRealObjectEndPointSyncState)));
        }