public void should_generate_ids_in_order() { long next_hi = 1; var generator = new HiLoGenerator(key => NextHi(ref next_hi)); for (int i = 0; i <= kMaxLo; i++) { Assert.That(generator.Generate(), Is.EqualTo(i + 1)); } }
public void should_generate_ids_between_hi_and_hi_plus_max_lo() { int first_hi = 1; long next_hi = first_hi; var generator = new HiLoGenerator(key => NextHi(ref next_hi)); long id = 0; for (int i = 0; i <= kMaxLo; i++) { id = generator.Generate(); } Assert.That(id, Is.EqualTo(first_hi + kMaxLo)); }