Esempio n. 1
0
        public void InsertAllFailureInsideTransaction()
        {
            var testObjects = Enumerable.Range(1, 20).Select(i => new UniqueObj {
                Id = i
            }).ToList();

            testObjects[testObjects.Count - 1].Id = 1;             // causes the insert to fail because of duplicate key

            ExceptionAssert.Throws <SQLiteException>(() => _db.RunInTransaction(() => {
                _db.InsertAll(testObjects);
            }));

            Assert.AreEqual(0, _db.Table <UniqueObj>().Count());
        }
Esempio n. 2
0
        public void SuccessfulSavepointTransaction()
        {
            db.RunInTransaction(() => {
                db.Delete(testObjects[0]);
                db.Delete(testObjects[1]);
                db.Insert(new TestObj());
            });

            Assert.AreEqual(testObjects.Count - 1, db.Table <TestObj>().Count());
        }