コード例 #1
0
        public void GetState_Invalidated_AfterCommit()
        {
            var subTransaction = _transaction.CreateSubTransaction();

            subTransaction.EnsureDataAvailable(_existingOrder.ID);
            subTransaction.ExecuteInScope(() => _existingOrder.OrderNumber++);

            var cachingListener   = new DomainObjectStateCache(subTransaction);
            var stateBeforeChange = cachingListener.GetState(_existingOrder.ID);

            subTransaction.Commit();
            var stateAfterChange = cachingListener.GetState(_existingOrder.ID);

            Assert.That(stateBeforeChange, Is.EqualTo(StateType.Changed));
            Assert.That(stateAfterChange, Is.EqualTo(StateType.Unchanged));
        }
コード例 #2
0
 public void GetState_IsInvalid()
 {
     LifetimeService.DeleteObject(_transaction, _newOrder);
     Assert.That(_cachingListener.GetState(_newOrder.ID), Is.EqualTo(StateType.Invalid));
 }
コード例 #3
0
 public StateType GetState(ObjectID objectID)
 {
     return(_domainObjectStateCache.GetState(objectID));
 }