예제 #1
0
        public void CreateSubTransaction_OfSubTransaction()
        {
            ClientTransaction subTransaction1 = TestableClientTransaction.CreateSubTransaction();
            ClientTransaction subTransaction2 = subTransaction1.CreateSubTransaction();

            Assert.That(ClientTransactionTestHelper.GetPersistenceStrategy(subTransaction2), Is.TypeOf(typeof(SubPersistenceStrategy)));
        }
예제 #2
0
        public void CreateSubTransaction()
        {
            ClientTransaction subTransaction = TestableClientTransaction.CreateSubTransaction();

            Assert.That(subTransaction, Is.Not.Null);
            Assert.That(ClientTransactionTestHelper.GetPersistenceStrategy(subTransaction), Is.TypeOf(typeof(SubPersistenceStrategy)));
        }
예제 #3
0
        public void InactiveTransactionIsActivated_ForEvents_EvenWhenAlreadyCurrent()
        {
            var inactiveClientTransaction = ClientTransaction.CreateRootTransaction();

            using (inactiveClientTransaction.EnterNonDiscardingScope())
            {
                using (ClientTransactionTestHelper.MakeInactive(inactiveClientTransaction))
                {
                    var transactionEventReceiverMock = MockRepository.GenerateStrictMock <ClientTransactionMockEventReceiver> (inactiveClientTransaction);
                    transactionEventReceiverMock
                    .Expect(mock => mock.SubTransactionCreated(Arg <ClientTransaction> .Is.Anything, Arg <SubTransactionCreatedEventArgs> .Is.Anything))
                    .WhenCalled(
                        mi =>
                    {
                        Assert.That(ClientTransaction.Current, Is.SameAs(inactiveClientTransaction));
                        Assert.That(ClientTransaction.Current.ActiveTransaction, Is.SameAs(inactiveClientTransaction));
                    });

                    var eventBroker = new ClientTransactionEventBroker(inactiveClientTransaction);
                    eventBroker.RaiseSubTransactionCreatedEvent(ClientTransactionObjectMother.Create());

                    transactionEventReceiverMock.VerifyAllExpectations();
                }
            }
        }
예제 #4
0
        private void CheckTransactionIsEmpty(ClientTransaction clientTransaction)
        {
            var dataManager = ClientTransactionTestHelper.GetIDataManager(clientTransaction);

            Assert.That(dataManager.RelationEndPoints, Is.Empty);
            Assert.That(dataManager.DataContainers, Is.Empty);
        }
        public void CreateRootTransaction_WithEnabledSecurity()
        {
            ITransactionFactory factory = new SecurityClientTransactionFactory();

            _testHelper.SetupSecurityIoCConfiguration();
            ITransaction transaction;

            try
            {
                Assert.That(SecurityConfiguration.Current.DisableAccessChecks, Is.False);
                transaction = factory.CreateRootTransaction();
            }
            finally
            {
                _testHelper.TearDownSecurityIoCConfiguration();
            }

            var clientTransaction   = transaction.To <ClientTransaction>();
            var persistenceStrategy = ClientTransactionTestHelper.GetPersistenceStrategy(clientTransaction);

            Assert.That(persistenceStrategy, Is.InstanceOf(typeof(RootPersistenceStrategy)));
            Assert.That(
                clientTransaction.Extensions,
                Has.Some.InstanceOf(typeof(SecurityClientTransactionExtension))
                .With.Property("Key").EqualTo(typeof(SecurityClientTransactionExtension).FullName));
        }
        public void TryUnloadData_Failure_InHigherTransaction()
        {
            TestableClientTransaction.EnsureDataAvailable(DomainObjectIDs.Order1);
            Assert.That(TestableClientTransaction.DataManager.DataContainers[DomainObjectIDs.Order1], Is.Not.Null);
            TestableClientTransaction.DataManager.DataContainers[DomainObjectIDs.Order1].MarkAsChanged();

            var subTransaction    = TestableClientTransaction.CreateSubTransaction();
            var subDataManager    = ClientTransactionTestHelper.GetDataManager(subTransaction);
            var parentDataManager = TestableClientTransaction.DataManager;

            subTransaction.EnsureDataAvailable(DomainObjectIDs.Order1);

            Assert.That(subDataManager.DataContainers[DomainObjectIDs.Order1], Is.Not.Null);
            Assert.That(parentDataManager.DataContainers[DomainObjectIDs.Order1], Is.Not.Null);

            Assert.That(subDataManager.DataContainers[DomainObjectIDs.Order1].State, Is.EqualTo(StateType.Unchanged));
            Assert.That(parentDataManager.DataContainers[DomainObjectIDs.Order1].State, Is.EqualTo(StateType.Changed));

            var result = UnloadService.TryUnloadData(subTransaction, DomainObjectIDs.Order1);

            Assert.That(result, Is.False);
            Assert.That(subDataManager.DataContainers[DomainObjectIDs.Order1], Is.Not.Null);
            Assert.That(subDataManager.DataContainers[DomainObjectIDs.Order1].State, Is.EqualTo(StateType.Unchanged));
            Assert.That(parentDataManager.DataContainers[DomainObjectIDs.Order1], Is.Not.Null);
            Assert.That(parentDataManager.DataContainers[DomainObjectIDs.Order1].State, Is.EqualTo(StateType.Changed));
        }
        protected void CheckPropertyEquivalent <TDomainObject, TValue> (
            ClientTransaction clientTransaction,
            TDomainObject domainObject,
            Expression <Func <TDomainObject, IEnumerable <TValue> > > propertyExpression,
            IEnumerable <TValue> expectedCurrentValue,
            IEnumerable <TValue> expectedOriginalValue)
            where TDomainObject : IDomainObject
        {
            var isReadOnlyTransaction = !clientTransaction.IsWriteable;

            if (isReadOnlyTransaction)
            {
                ClientTransactionTestHelper.SetIsWriteable(clientTransaction, true);
            }

            try
            {
                var propertyAccessor = GetPropertyAccessor(domainObject, propertyExpression, clientTransaction);
                Assert.That(propertyAccessor.GetValueWithoutTypeCheck(), Is.EquivalentTo(expectedCurrentValue));
                Assert.That(propertyAccessor.GetOriginalValueWithoutTypeCheck(), Is.EquivalentTo(expectedOriginalValue));
            }
            finally
            {
                if (isReadOnlyTransaction)
                {
                    ClientTransactionTestHelper.SetIsWriteable(clientTransaction, false);
                }
            }
        }
        public void CreateSubTransaction()
        {
            var  counter = new OrderedExpectationCounter();
            bool subTransactionCreatingCalled = false;

            _thisEventSinkWithStrictMock.Expect(mock => mock.RaiseSubTransactionCreatingEvent())
            .WhenCalledOrdered(counter, mi =>
            {
                Assert.That(_manager.IsWriteable, Is.True);
                subTransactionCreatingCalled = true;
            });

            ClientTransaction fakeSubTransaction = ClientTransactionObjectMother.CreateWithParent(_thisTransaction);
            Func <ClientTransaction, ClientTransaction> factory = tx =>
            {
                Assert.That(tx, Is.SameAs(_thisTransaction));
                Assert.That(subTransactionCreatingCalled, Is.True);
                Assert.That(_manager.IsWriteable, Is.False, "IsWriteable needs to be set before the factory is called.");
                ClientTransactionTestHelper.SetIsWriteable(_thisTransaction, false); // required by assertion in ReadOnlyClientTransactionListener
                return(fakeSubTransaction);
            };

            _hierarchyStrictMock.Expect(mock => mock.AppendLeafTransaction(fakeSubTransaction)).Ordered(counter);
            _thisEventSinkWithStrictMock.Expect(mock => mock.RaiseSubTransactionCreatedEvent(fakeSubTransaction)).Ordered(counter);

            var result = _manager.CreateSubTransaction(factory);

            Assert.That(result, Is.Not.Null.And.SameAs(fakeSubTransaction));
            Assert.That(_manager.SubTransaction, Is.SameAs(fakeSubTransaction));
            Assert.That(_manager.IsWriteable, Is.False);

            _hierarchyStrictMock.VerifyAllExpectations();
        }
        public void TryUnloadVirtualEndPoint_Failure_InHigherTransaction()
        {
            var orders = _collectionEndPointID.ObjectID.GetObject <Customer> ().Orders;

            orders.Clear();

            var subTransaction    = TestableClientTransaction.CreateSubTransaction();
            var subDataManager    = ClientTransactionTestHelper.GetDataManager(subTransaction);
            var parentDataManager = TestableClientTransaction.DataManager;

            EnsureEndPointLoadedAndComplete(subDataManager, _collectionEndPointID);

            Assert.That(subDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID).IsDataComplete, Is.True);
            Assert.That(subDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID).HasChanged, Is.False);

            Assert.That(parentDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID).IsDataComplete, Is.True);
            Assert.That(parentDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID).HasChanged, Is.True);

            var result = UnloadService.TryUnloadVirtualEndPoint(subTransaction, _collectionEndPointID);

            Assert.That(result, Is.False);

            Assert.That(subDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID), Is.Not.Null);
            Assert.That(subDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID).IsDataComplete, Is.True);
            Assert.That(subDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID).HasChanged, Is.False);

            Assert.That(parentDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID), Is.Not.Null);
            Assert.That(parentDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID).IsDataComplete, Is.True);
            Assert.That(parentDataManager.GetRelationEndPointWithoutLoading(_collectionEndPointID).HasChanged, Is.True);
        }
        public void RelationChanging_LoadedObject_ForbiddenWhenEndPointCompleteInSubTransaction()
        {
            ClientTransactionTestHelper.SetIsWriteable(_transaction, false);

            _listener.AddCurrentlyLoadingObjectIDs(new[] { DomainObjectIDs.Order1 });
            Assert.That(_listener.IsInLoadMode, Is.True);

            var fakeSubTransaction = CreateFakeSubTransaction(_transaction);

            var relationEndPointID = RelationEndPointID.Create(_order1.ID, _orderTicketEndPointDefinition);

            // Works if there is no matching end-point in the subtx.
            Assert.That(ClientTransactionTestHelper.GetIDataManager(fakeSubTransaction).RelationEndPoints[relationEndPointID], Is.Null);
            Assert.That(() => _listener.RelationChanging(_transaction, _order1, _orderTicketEndPointDefinition, null, null), Throws.Nothing);

            fakeSubTransaction.EnsureDataComplete(relationEndPointID);
            var relationEndPoint = (IVirtualEndPoint)ClientTransactionTestHelper.GetIDataManager(fakeSubTransaction).RelationEndPoints[relationEndPointID];

            // Still works if the matching end-point is incomplete
            relationEndPoint.MarkDataIncomplete();
            Assert.That(ClientTransactionTestHelper.GetIDataManager(fakeSubTransaction).RelationEndPoints[relationEndPointID].IsDataComplete, Is.False);
            Assert.That(() => _listener.RelationChanging(_transaction, _order1, _orderTicketEndPointDefinition, null, null), Throws.Nothing);

            // Throws if the matching end-point is complete
            relationEndPoint.EnsureDataComplete();
            Assert.That(ClientTransactionTestHelper.GetIDataManager(fakeSubTransaction).RelationEndPoints[relationEndPointID].IsDataComplete, Is.True);
            Assert.That(
                () => _listener.RelationChanging(_transaction, _order1, _orderTicketEndPointDefinition, null, null),
                Throws.InvalidOperationException.With.Message.EqualTo(
                    "The relation property 'Remotion.Data.DomainObjects.UnitTests.TestDomain.Order.OrderTicket' of object "
                    + "'Order|5682f032-2f0b-494b-a31c-c97f02b89c36|System.Guid' can no longer be modified because its "
                    + "data has already been loaded into the subtransaction."));
        }
        public override void SetUp()
        {
            base.SetUp();

            _transaction = ClientTransaction.CreateRootTransaction().CreateSubTransaction();

            _unchangedObject = GetUnchangedObject();
            _changedObject   = GetChangedObject();
            _newObject       = GetNewObject();
            _deletedObject   = GetDeletedObject();

            _mockRepository = new MockRepository();

            // Listener is a dynamic mock so that we don't have to expect all the internal events of committing
            _listenerMock  = _mockRepository.DynamicMock <IClientTransactionListener> ();
            _extensionMock = _mockRepository.StrictMock <ClientTransactionExtensionBase> ("test");
            _transactionMockEventReceiver = _mockRepository.StrictMock <ClientTransactionMockEventReceiver> (_transaction);

            _changedObjectEventReceiverMock   = CreateDomainObjectMockEventReceiver(_changedObject);
            _newObjectEventReceiverMock       = CreateDomainObjectMockEventReceiver(_newObject);
            _deletedObjectEventReceiverMock   = CreateDomainObjectMockEventReceiver(_deletedObject);
            _unchangedObjectEventReceiverMock = CreateDomainObjectMockEventReceiver(_unchangedObject);

            ClientTransactionTestHelper.AddListener(_transaction, _listenerMock);
            _transaction.Extensions.Add(_extensionMock);
        }
        private ClientTransaction CreateFakeSubTransaction(ClientTransaction clientTransaction)
        {
            var fakeSubTransaction = ClientTransactionObjectMother.Create();

            ClientTransactionTestHelper.SetSubTransaction(clientTransaction, fakeSubTransaction);
            return(fakeSubTransaction);
        }
        public void Synchronize_WithSubtransactions_LoadedInRootAndSub_SyncedInSub()
        {
            Company          company;
            IndustrialSector industrialSector;

            PrepareInconsistentState_OneMany_ObjectIncluded(out company, out industrialSector);

            CheckSyncState(company, c => c.IndustrialSector, true);
            CheckSyncState(industrialSector, s => s.Companies, false);

            using (ClientTransaction.Current.CreateSubTransaction().EnterDiscardingScope())
            {
                var relationEndPointID = RelationEndPointID.Resolve(industrialSector, s => s.Companies);

                var dataManager = ClientTransactionTestHelper.GetDataManager(ClientTransaction.Current);
                var endPoint    = dataManager.GetRelationEndPointWithLazyLoad(relationEndPointID);
                Assert.That(endPoint.IsSynchronized, Is.Null);

                endPoint.EnsureDataComplete();
                Assert.That(endPoint.IsSynchronized, Is.False);

                BidirectionalRelationSyncService.Synchronize(ClientTransaction.Current, relationEndPointID);

                CheckSyncState(industrialSector, s => s.Companies, true);
                Assert.That(endPoint.IsSynchronized, Is.True);
            }

            CheckSyncState(industrialSector, s => s.Companies, true);
        }
        public void TryUnloadVirtualEndPointAndItemData_Failure_InHigherTransaction()
        {
            var customer             = DomainObjectIDs.Customer1.GetObject <Customer> ();
            var parentOrdersEndPoint = DomainObjectCollectionDataTestHelper.GetAssociatedEndPoint(customer.Orders);

            EnsureEndPointLoadedAndComplete(parentOrdersEndPoint.ID);

            customer.Orders[0].RegisterForCommit();

            Assert.That(parentOrdersEndPoint.Collection[0].State, Is.EqualTo(StateType.Changed));

            var subTransaction    = TestableClientTransaction.CreateSubTransaction();
            var subOrdersEndPoint = (ICollectionEndPoint)ClientTransactionTestHelper.GetDataManager(subTransaction).GetRelationEndPointWithLazyLoad(
                parentOrdersEndPoint.ID);

            EnsureEndPointLoadedAndComplete(ClientTransactionTestHelper.GetDataManager(subTransaction), subOrdersEndPoint.ID);

            Assert.That(subOrdersEndPoint.Collection[0].TransactionContext[subTransaction].State, Is.EqualTo(StateType.Unchanged));

            var result = UnloadService.TryUnloadVirtualEndPointAndItemData(subTransaction, parentOrdersEndPoint.ID);

            Assert.That(result, Is.False);
            Assert.That(subOrdersEndPoint.IsDataComplete, Is.True);
            Assert.That(parentOrdersEndPoint.IsDataComplete, Is.True);
        }
        protected void CheckEndPointIncomplete(ClientTransaction clientTransaction, RelationEndPointID relationEndPointID)
        {
            var relationEndPoint = ClientTransactionTestHelper.GetIDataManager(clientTransaction).RelationEndPoints[relationEndPointID];

            Assert.That(relationEndPoint, Is.Not.Null);
            Assert.That(relationEndPoint.IsDataComplete, Is.False);
        }
        public static CollectionEndPoint CreateCollectionEndPoint(
            RelationEndPointID endPointID,
            IEnumerable <DomainObject> initialContents,
            ClientTransaction clientTransaction = null)
        {
            clientTransaction = clientTransaction ?? ClientTransactionScope.CurrentTransaction;
            var dataManager             = ClientTransactionTestHelper.GetDataManager(clientTransaction);
            var changeDetectionStrategy = new RootCollectionEndPointChangeDetectionStrategy();
            var dataStrategyFactory     = new AssociatedCollectionDataStrategyFactory(dataManager);
            var collectionEndPoint      = new CollectionEndPoint(
                clientTransaction,
                endPointID,
                new CollectionEndPointCollectionManager(endPointID, new CollectionEndPointCollectionProvider(dataStrategyFactory), dataStrategyFactory),
                dataManager,
                dataManager,
                ClientTransactionTestHelper.GetEventBroker(clientTransaction),
                new CollectionEndPointDataManagerFactory(changeDetectionStrategy));

            if (initialContents != null)
            {
                CollectionEndPointTestHelper.FillCollectionEndPointWithInitialContents(collectionEndPoint, initialContents);
            }

            return(collectionEndPoint);
        }
예제 #17
0
        public static IClientTransactionListener CreateAndAddListenerStrictMock(ClientTransaction clientTransaction)
        {
            var listenerMock = MockRepository.GenerateStrictMock <IClientTransactionListener>();

            ClientTransactionTestHelper.AddListener(clientTransaction, listenerMock);
            return(listenerMock);
        }
예제 #18
0
        public void Synchronize_InTransactionHierarchy_StartsWithRoot()
        {
            var endPointID = RelationEndPointID.Create(DomainObjectIDs.Order1, typeof(Order), "OrderItems");

            var endPointMockInParent = MockRepository.GenerateStrictMock <IRelationEndPoint> ();

            endPointMockInParent.Stub(stub => stub.ID).Return(endPointID);
            endPointMockInParent.Stub(stub => stub.Definition).Return(endPointID.Definition);
            endPointMockInParent.Stub(stub => stub.IsDataComplete).Return(true);
            endPointMockInParent.Expect(mock => mock.Synchronize());
            endPointMockInParent.Replay();
            RelationEndPointManagerTestHelper.AddEndPoint(_relationEndPointManager, endPointMockInParent);

            var subTransaction    = _transaction.CreateSubTransaction();
            var endPointMockInSub = MockRepository.GenerateStrictMock <IRelationEndPoint> ();

            endPointMockInSub.Stub(stub => stub.ID).Return(endPointID);
            endPointMockInSub.Stub(stub => stub.Definition).Return(endPointID.Definition);
            endPointMockInSub.Stub(stub => stub.IsDataComplete).Return(true);
            endPointMockInSub.Expect(mock => mock.Synchronize());
            endPointMockInSub.Replay();
            DataManagerTestHelper.AddEndPoint(ClientTransactionTestHelper.GetDataManager(subTransaction), endPointMockInSub);

            BidirectionalRelationSyncService.Synchronize(subTransaction, endPointID);

            endPointMockInParent.VerifyAllExpectations();
            endPointMockInSub.VerifyAllExpectations();
        }
        public static RealObjectEndPoint CreateRealObjectEndPoint(RelationEndPointID endPointID, DataContainer dataContainer)
        {
            var clientTransaction    = dataContainer.ClientTransaction;
            var endPointProvider     = ClientTransactionTestHelper.GetDataManager(clientTransaction);
            var transactionEventSink = ClientTransactionTestHelper.GetEventBroker(clientTransaction);

            return(new RealObjectEndPoint(clientTransaction, endPointID, dataContainer, endPointProvider, transactionEventSink));
        }
예제 #20
0
 private NewObjectInitializationContext CreateNewObjectInitializationContext(ObjectID objectID, ClientTransaction rootTransaction)
 {
     return(new NewObjectInitializationContext(
                objectID,
                rootTransaction,
                ClientTransactionTestHelper.GetEnlistedDomainObjectManager(rootTransaction),
                ClientTransactionTestHelper.GetIDataManager(rootTransaction)));
 }
예제 #21
0
        private ClientTransaction CreateSubTransactionAndClearListeners(ClientTransaction parentTransaction)
        {
            var subTransaction = parentTransaction.CreateSubTransaction();

            ClientTransactionTestHelper.ClearAllListeners(subTransaction);
            InstallUnlockWatcher(subTransaction);
            return(subTransaction);
        }
예제 #22
0
        public void GetLazyLoader()
        {
            var dataManager = ClientTransactionTestHelper.GetDataManager(_fakeConstructedTransaction);

            var result = _factory.CallGetLazyLoader(dataManager);

            Assert.That(result, Is.SameAs(result));
        }
        public void ObjectDeleting_ForbiddenInLoadMode()
        {
            ClientTransactionTestHelper.SetIsWriteable(_transaction, false);

            CheckForbiddenOperationWithLoadMode(
                () => _listener.ObjectDeleting(_transaction, _client1),
                "Object 'Client|1627ade8-125f-4819-8e33-ce567c42b00c|System.Guid' cannot be deleted.");
        }
예제 #24
0
 public void CreateObjectReference_CallsReferenceInitializing_InRightTransaction_WithActivatedInactiveTransaction()
 {
     using (ClientTransactionTestHelper.MakeInactive(_transaction))
     {
         var domainObject = (Order)_domainObjectCreator.CreateObjectReference(_order1InitializationContext, _transaction);
         Assert.That(domainObject.OnReferenceInitializingTx, Is.SameAs(_transaction));
         Assert.That(domainObject.OnReferenceInitializingActiveTx, Is.SameAs(_transaction));
     }
 }
 protected void RegisterForCommitWithDisabledListener(DomainObject domainObject)
 {
     // WORKAROUND: Remove listener before calling RegisterForCommit to avoid the event triggering mocked methods.
     // (Yes, the listener is a dynamic mock, but due to a bug in Rhino.Mocks, triggering an unexpected mocked method method will destroy the
     // MockRepository's replay state...)
     ClientTransactionTestHelper.RemoveListener(Transaction, ListenerMock);
     Transaction.ExecuteInScope(domainObject.RegisterForCommit);
     ClientTransactionTestHelper.AddListener(Transaction, ListenerMock);
 }
        public void RelationChanging_ForbiddenWhenTransactionReadOnly()
        {
            ClientTransactionTestHelper.SetIsWriteable(_transaction, false);
            Assert.That(_listener.IsInLoadMode, Is.False);

            Assert.That(
                () => _listener.RelationChanging(_transaction, _order1, _orderTicketEndPointDefinition, null, null),
                Throws.TypeOf <ClientTransactionReadOnlyException> ());
        }
        public void OnBeforeTransactionInitialize()
        {
            _parentEventSinkWithStrictMock.Expect(mock => mock.RaiseSubTransactionInitializeEvent(_thisTransaction));
            ClientTransactionTestHelper.SetIsWriteable(_parentTransaction, false); // required by assertion in ReadOnlyClientTransactionListener

            _manager.OnBeforeTransactionInitialize();

            _parentEventSinkWithStrictMock.VerifyAllExpectations();
        }
        public void RelationChanging_SomeObject_ForbiddenInLoadMode()
        {
            ClientTransactionTestHelper.SetIsWriteable(_transaction, false);

            CheckForbiddenOperationWithLoadMode(
                () => _listener.RelationChanging(_transaction, _order1, _orderTicketEndPointDefinition, null, null),
                "The object 'Order|5682f032-2f0b-494b-a31c-c97f02b89c36|System.Guid' cannot be modified. "
                + "(Modified property: 'Remotion.Data.DomainObjects.UnitTests.TestDomain.Order.OrderTicket'.)");
        }
        public void PropertyValueChanging_ForbiddenWhenTransactionReadOnly()
        {
            ClientTransactionTestHelper.SetIsWriteable(_transaction, false);
            Assert.That(_listener.IsInLoadMode, Is.False);

            Assert.That(
                () => _listener.PropertyValueChanging(_transaction, _order1, _orderNumberPropertyDefinition, null, null),
                Throws.TypeOf <ClientTransactionReadOnlyException> ());
        }
예제 #30
0
        public static DomainObject GetChangedObject(ClientTransaction transaction, ObjectID objectID)
        {
            var changedInstance = LifetimeService.GetObject(transaction, objectID, false);

            changedInstance.RegisterForCommit();
            Assert.That(changedInstance.State, Is.EqualTo(StateType.Changed));
            Assert.That(ClientTransactionTestHelper.GetDataManager(transaction).DataContainers[objectID].State, Is.EqualTo(StateType.Changed));
            return(changedInstance);
        }