Ejemplo n.º 1
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);
     }
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 4
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>
 public Transaction(TransactionStack transactionStack)
 {
     this.transactionStack  = transactionStack;
     synchronizationContext = SynchronizationContext.Current;
 }
Ejemplo n.º 5
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>
 public Transaction(TransactionStack transactionStack)
 {
     this.transactionStack = transactionStack;
     synchronizationContext = SynchronizationContext.Current;
 }