public void WhenISelectAnAccountWithProration(string proration) { var imis = Context <IMIS>(IMIS); Name cm = null; int count = 0; while (count < 10) { IEnumerable <Name> names; if (proration == "with") { names = imis.FindAccountWithProration(15); } else { names = imis.FindAccountWithoutProration(15); } var coId = LockUtils.PickUnusedAccount("coid", names.Select(o => o.ID)); if (coId != null) { cm = names.Where(o => o.ID == coId).First(); break; } count += 1; Task.Delay(RandUtils.RandInt(1000, 2000)).Wait(); } cm.ShouldNotBeNull(); cm.ID.ShouldNotBeEmpty(); Console.WriteLine($"CO_ID={cm.ID}"); var account = new Account(imis, cm.ID); Ctx.OriginalAccount = account; }