public void CachesContents() { var db = new UnreliableDb(); _setup(db); var box = new LockBox(db, "Tbl", _criteria); Assert.True(box.Any(), "The box should not have been empty"); // Now, we'll make the database blow up if it gets accessed again db.FailOnNextOp = true; // When we access the box again, it shouldn't make the db explode Assert.True(box.Any(), "This should not blow up the box"); }
protected UnreliableDb _setup(UnreliableDb db = null) { db = db ?? new UnreliableDb(); db.Insert("Tbl", new { ShouldProcess = true, LockId = DBNull.Value, LockDate = DBNull.Value }); return db; }