public void Dequeue_pops_ranges() { var collection = new EntityRangeCollection(); collection.Add(new EntityRangeCollection.EntityIdRange(new EntityId(1), 1)); collection.Add(new EntityRangeCollection.EntityIdRange(new EntityId(2), 1)); collection.Dequeue(); collection.Dequeue(); Assert.AreEqual(0, collection.Count); }
public void Dequeue_when_empty_throws() { var collection = new EntityRangeCollection(); Assert.Throws <InvalidOperationException>(() => collection.Dequeue()); Assert.AreEqual(0, collection.Count); }
public void Dequeue_when_not_empty() { var collection = new EntityRangeCollection(); collection.Add(validRange); var result = collection.Dequeue(); Assert.AreEqual(validRange.FirstEntityId, result); Assert.AreEqual(ValidRangeCount - 1, collection.Count); }
public void Clear_resets_collection() { var collection = new EntityRangeCollection(); collection.Add(validRange); collection.Clear(); Assert.Throws <InvalidOperationException>(() => collection.Dequeue()); Assert.Throws <ArgumentOutOfRangeException>(() => collection.Take(1)); Assert.AreEqual(0, collection.Count); }