Esempio n. 1
0
        public void SerializableTransactionShouldProceed()
        {
            string value       = Guid.NewGuid().ToString();
            var    transaction = new KvsTransaction();

            var    transaction1 = new KvsTransaction();
            string value1       = Guid.NewGuid().ToString();

            var    transaction2 = new KvsTransaction();
            string value2       = Guid.NewGuid().ToString();

            transaction.Write(Key, value);
            transaction.Write(Key2, value);
            transaction.Commit();

            transaction1.Read(Key);
            transaction1.Read(Key2);

            transaction2.Read(Key);
            transaction2.Read(Key2);

            transaction1.Write(Key, value1);
            Assert.AreEqual(transaction1.Commit(), KvsTransaction.TransactionStatus.CompletedWithSuccess);

            transaction2.Write(Key2, value2);
            Assert.AreEqual(transaction2.Commit(), KvsTransaction.TransactionStatus.CompletedWithFailure);
        }
Esempio n. 2
0
        private void JustDoIt()
        {
            string Key = "key" + (new Random()).Next();
            string value = Guid.NewGuid().ToString();
            var transaction = new KvsTransaction();
            //var currentValue = transaction.Read(transactionId);
            transaction.Write(Key, value);
            transaction.Commit();

            //transaction = new KvsTransaction();
            //Assert.AreEqual(transaction.Read(Key), value);
        }