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);
            }
        }
 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);
     }
 }
        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);
            }
        }
 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);
     }
 }