public void FetchUntilNot_FailsAfter10() { // save a ci var ciRep = new CharityInfoRepository(); var ci = new CharityInfo(); ci.CharityName = "testprod"; ciRep.SaveOrUpdate(ci); int savedId = ci.Id; this.FlushSessionAndEvict(ci); var ciRep2 = new CharityInfoRepository(); var tasks = new MatchTasks(ciRep2); bool expectedErrorFound = false; try { var randomCi = tasks.FetchUntilNot(0, savedId + 1, savedId + 11); } catch (ApplicationException appex) { if (appex.Message.StartsWith("FetchUntilNot failed to find a random entity after")) expectedErrorFound = true; } Assert.IsTrue(expectedErrorFound); }
public void FetchUntilNot_CanFetch() { var minmax = MakeSomeData(10); var ciRep2 = new CharityInfoRepository(); var tasks = new MatchTasks(ciRep2); var randomCi = tasks.FetchUntilNot(minmax.Item1, minmax.Item1 - 1, minmax.Item2 + 1); Assert.IsNotNull(randomCi); Assert.AreNotEqual(minmax.Item1, randomCi.Id); }