SetValue() public method

public SetValue ( Transaction transaction, object value ) : void
transaction Transaction
value object
return void
示例#1
0
 public void RaiseIfTwoTransactionChangeTheSameSlot()
 {
     IObject obj = new BaseObject(null, new object[] { 1, 2, 3 });
     TransactionalValue tvalue = new TransactionalValue(this.trobj, 0);
     Transaction transaction1 = this.CreateTransaction();
     tvalue.SetValue(transaction1, 2);
     Transaction transaction2 = this.CreateTransaction();
     tvalue.SetValue(transaction2, 3);
 }
示例#2
0
        public void RaiseIfTransactionChangeACommittedSlot()
        {
            IObject obj = new BaseObject(null, new object[] { 1, 2, 3 });
            TransactionalValue tvalue = new TransactionalValue(this.trobj, 0);
            Transaction transaction1 = this.CreateTransaction();

            Transaction transaction2 = this.CreateTransaction();
            tvalue.SetValue(transaction2, 3);
            transaction2.Commit(this.manager.Time + 1);
            ////tvalue.CommitValue(transaction2);
            tvalue.SetValue(transaction1, 2);
        }
示例#3
0
 public void SetAndGetValueInTransaction()
 {
     IObject obj = new BaseObject(null, new object[] { 1, 2, 3 });
     TransactionalValue tvalue = new TransactionalValue(this.trobj, 2);
     Transaction transaction = this.CreateTransaction();
     tvalue.SetValue(transaction, 2);
     Assert.AreEqual(2, tvalue.GetValue(transaction));
     Assert.AreEqual(3, tvalue.GetValue(0));
 }
示例#4
0
        public void TwoSerializedTransactions()
        {
            IObject obj = new BaseObject(null, new object[] { 1, 2, 3 });
            TransactionalValue tvalue = new TransactionalValue(this.trobj, 0);
            Transaction transaction1 = this.CreateTransaction();
            tvalue.SetValue(transaction1, 2);
            tvalue.CommitValue(transaction1);

            Assert.AreEqual(2, tvalue.GetValue(0));

            Transaction transaction2 = this.CreateTransaction();
            tvalue.SetValue(transaction2, 3);
            tvalue.CommitValue(transaction2);

            Assert.AreEqual(3, tvalue.GetValue(0));
        }