Exemplo n.º 1
0
        public void Transaction_Can_Delete_Record_Multi_Tran()
        {

            var collection = new FoxCollection<int>(NullSerializationStrategy.Default);
            string itemKey;

            using (var tran = collection.BeginTransaction())
            {
                itemKey = tran.Insert(1);

                tran.Commit();
            }

            Assert.Equal(1, collection.Get(itemKey));
            Assert.True(collection.Keys.Contains(itemKey));

            using (var tran = collection.BeginTransaction())
            {
                tran.Delete(itemKey);

                tran.Commit();
            }

            Assert.Equal(default(int), collection.Get(itemKey));
            Assert.False(collection.Keys.Contains(itemKey));
        }
Exemplo n.º 2
0
        public void Transaction_Can_Update_Record_Multi_Transaction()
        {

            var collection = new FoxCollection<int>(NullSerializationStrategy.Default);
            string itemKey;

            using (var tran = collection.BeginTransaction())
            {
                itemKey = tran.Insert(1);

                tran.Commit();
            }

            Assert.Equal(1, collection.Get(itemKey));

            using (var tran = collection.BeginTransaction())
            {
                tran.Update(itemKey, 2);

                tran.Commit();
            }

            Assert.Equal(2, collection.Get(itemKey));
        }