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);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Transaction"/> class.
 /// </summary>
 /// <param name="transactionStack">The <see cref="TransactionStack"/> associated to this transaction.</param>
 /// <param name="flags">The flags to apply to this transaction.</param>.
 public Transaction(TransactionStack transactionStack, TransactionFlags flags)
 {
     this.transactionStack  = transactionStack;
     this.Flags             = flags;
     synchronizationContext = SynchronizationContext.Current;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Transaction"/> class.
 /// </summary>
 /// <param name="transactionStack">The <see cref="TransactionStack"/> associated to this transaction.</param>
 public Transaction(TransactionStack transactionStack)
 {
     this.transactionStack  = transactionStack;
     synchronizationContext = SynchronizationContext.Current;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Transaction"/> class.
 /// </summary>
 /// <param name="transactionStack">The <see cref="TransactionStack"/> associated to this transaction.</param>
 public Transaction(TransactionStack transactionStack)
 {
     this.transactionStack = transactionStack;
     synchronizationContext = SynchronizationContext.Current;
 }