private IList AllocateAllAvailableIds(IIdSystem idSystem) { IList ids = new ArrayList(); int newId = 0; do { newId = idSystem.NewId(); ids.Add(newId); }while (newId < MaxValidId); return(ids); }
private void AssertFreeAndReallocate(IIdSystem idSystem, IList ids) { // Boundary condition: Last ID. Produced a bug when implementing. if (!ids.Contains(MaxValidId)) { ids.Add(MaxValidId); } Assert.IsGreater(0, ids.Count); idSystem.ReturnUnusedIds(new _IVisitable_184(ids)); int freedCount = ids.Count; for (int i = 0; i < freedCount; i++) { int newId = idSystem.NewId(); Assert.IsTrue(ids.Contains(newId)); ids.Remove((object)newId); } Assert.IsTrue(ids.Count == 0); AssertNoMoreIdAvailable(idSystem); }
private IList AllocateAllAvailableIds(IIdSystem idSystem) { IList ids = new ArrayList(); int newId = 0; do { newId = idSystem.NewId(); ids.Add(newId); } while (newId < MaxValidId); return ids; }
public virtual int NewId() { return(_delegate.NewId()); }
/// <exception cref="System.Exception"></exception> public void Run() { idSystem.NewId(); }