[Test] public void testBombMissing() { var d = Objects.dictionaryOne(5, "hello"); AreEqual("hello", Bomb.missing(d, 5)); Bombs(() => Bomb.missing(d, 4), "no value for 4 in "); }
public void runTimers(DateTime time) { Bomb.unless(time.CompareTo(lastTestTimeRun) > 0, () => "attempting to run timers backwards or rerun the same time, \nlastTestTimeRun is " + ymdHuman(lastTestTimeRun) + "\nthis time: " + ymdHuman(time)); freezeNow(time); LogC.info("run " + Bomb.missing(allowedTimes, time) + " timers " + ymdHuman(time)); var actions = copy(timers.get(time)); timers.remove(time); allowedTimes.Remove(time); Bomb.when(isEmpty(actions), () => "no timers expecting to run on " + ymdHuman(time)); each(actions, action => action()); lastTestTimeRun = time; }