Example #1
0
        public void TransactionSuccessful()
        {
            var db = new RealDB(connString, new SQL2005DBAnalyzer(connString));
            var transaction = db.BeginTransaction();

            var person = new Person();
            person.FirstName = "test";
            person.LastName = "person";

            var keys = db.Insert("Person", person._AsDictionary(), transaction);

            transaction.Commit();

            Assert.AreEqual(1, db.RawRead("Person", keys).Count());
        }
Example #2
0
        public void TransactionAbandoned()
        {
            var keys = new Dictionary<string, object>();

            using (var db = new RealDB(connString, new SQL2005DBAnalyzer(connString)))
            {
                var transaction = db.BeginTransaction();

                var person = new Person();
                person.FirstName = "test";
                person.LastName = "person";

                keys = db.Insert("Person", person._AsDictionary(), transaction);
            }

            var conn = new RealDB(connString, new SQL2005DBAnalyzer(connString));
            Assert.AreEqual(0, conn.RawRead("Person", keys).Count());
        }