Пример #1
0
        public void DoNotRemoveOnRollback()
        {
            TransactionalWrapper <int, string> wrapper = new TransactionalWrapper <int, string> {
                { 1, "1" }, { 2, "2" }, { 3, "3" }
            };

            using (var transaction = wrapper.BeginTransaction())
            {
                transaction.Remove(1);
                transaction.Remove(3);

                Assert.IsTrue(transaction.Count == 1);

                wrapper.RollbackTransation(transaction);
            }
            Assert.IsTrue(wrapper.Count == 3);
        }
Пример #2
0
        public void DoNotAddOnRollback()
        {
            TransactionalWrapper <int, string> wrapper = new TransactionalWrapper <int, string>();

            using (var transaction = wrapper.BeginTransaction())
            {
                transaction.Add(1, "1");
                transaction.Add(2, "2");
                transaction.Add(3, "3");

                Assert.IsTrue(transaction.Count == 3);

                wrapper.RollbackTransation(transaction);
            }

            Assert.IsTrue(wrapper.Count == 0);
        }