Exemplo n.º 1
0
        public void TestSaveUndoSaveRedo()
        {
            var stack = new TransactionStack(5);

            using (var manager = new DirtiableManager(stack))
            {
                var dirtiable = new SimpleDirtiable();
                var operation = new SimpleDirtyingOperation(dirtiable.Yield());
                using (stack.CreateTransaction())
                {
                    stack.PushOperation(operation);
                }
                Assert.AreEqual(true, dirtiable.IsDirty);
                manager.CreateSnapshot();
                Assert.AreEqual(false, dirtiable.IsDirty);
                stack.Rollback();
                Assert.AreEqual(true, dirtiable.IsDirty);
                manager.CreateSnapshot();
                Assert.AreEqual(false, dirtiable.IsDirty);
                stack.Rollforward();
                Assert.AreEqual(true, dirtiable.IsDirty);
                manager.CreateSnapshot();
                Assert.AreEqual(false, dirtiable.IsDirty);
            }
        }
Exemplo n.º 2
0
 public void TestDoAction()
 {
     var stack = new TransactionStack(5);
     using (new DirtiableManager(stack))
     {
         var dirtiable = new SimpleDirtiable();
         using (stack.CreateTransaction())
         {
             var operation = new SimpleDirtyingOperation(dirtiable.Yield());
             stack.PushOperation(operation);
         }
         Assert.AreEqual(true, dirtiable.IsDirty);
     }
 }
Exemplo n.º 3
0
        public void TestDoAction()
        {
            var stack = new TransactionStack(5);

            using (new DirtiableManager(stack))
            {
                var dirtiable = new SimpleDirtiable();
                using (stack.CreateTransaction())
                {
                    var operation = new SimpleDirtyingOperation(dirtiable.Yield());
                    stack.PushOperation(operation);
                }
                Assert.AreEqual(true, dirtiable.IsDirty);
            }
        }
Exemplo n.º 4
0
 public void TestDoAndSave()
 {
     var stack = new TransactionStack(5);
     using (var manager = new DirtiableManager(stack))
     {
         var dirtiable = new SimpleDirtiable();
         var operation = new SimpleDirtyingOperation(dirtiable.Yield());
         using (stack.CreateTransaction())
         {
             stack.PushOperation(operation);
         }
         Assert.AreEqual(true, dirtiable.IsDirty);
         manager.CreateSnapshot();
         Assert.AreEqual(false, dirtiable.IsDirty);
     }
 }