Esempio n. 1
0
        public void UsingBlockClearsLock()
        {
            var db = _setup();

            using (var rows = new LockBox(db, "Tbl", _criteria))
            {
                Assert.AreNotEqual(0, rows.Count(), "We should have found rows");
            }

            var rows2 = new LockBox(db, "Tbl", _criteria);
            Assert.AreNotEqual(0, rows2.Count(), "The old lock went out of scope, so we should find rows here - they should be unlocked");
        }
Esempio n. 2
0
        public void WontLockLockedRows()
        {
            var db = _setup();

            var rows = new LockBox(db, "Tbl", _criteria);
            Assert.AreNotEqual(0, rows.Count(), "We should have found rows on the first lock");

            var rows2 = new LockBox(db, "Tbl", _criteria);
            Assert.AreEqual(0, rows2.Count(), "We shouldn't have found any rows on the second lock");
        }