Ejemplo n.º 1
0
        public void Transaction_is_rolled_back_if_something_happens()
        {
            using (var scope = new TransactionScope())
            {
                var test = new JustATest
                               {
                                   TestName = "testje"
                               };

                _session.Store(test);
                _session.SaveChanges();

                throw new Exception("This is expected");
                scope.Complete();
            }
        }
Ejemplo n.º 2
0
        public void JustWorksAsRegular()
        {
            using (var scope = new TransactionScope())
            {
                var test = new JustATest
                {
                    TestName = "testje"
                };

                _session.Store(test);
                _session.SaveChanges();

                scope.Complete();
                Debug.WriteLine("test is stored");
            }
        }