Example #1
0
            private IList AllocateAllAvailableIds(IIdSystem idSystem)
            {
                IList ids   = new ArrayList();
                int   newId = 0;

                do
                {
                    newId = idSystem.NewId();
                    ids.Add(newId);
                }while (newId < MaxValidId);
                return(ids);
            }
Example #2
0
            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);
            }
Example #3
0
			private IList AllocateAllAvailableIds(IIdSystem idSystem)
			{
				IList ids = new ArrayList();
				int newId = 0;
				do
				{
					newId = idSystem.NewId();
					ids.Add(newId);
				}
				while (newId < MaxValidId);
				return ids;
			}
Example #4
0
			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);
			}
Example #5
0
 public virtual int NewId()
 {
     return(_delegate.NewId());
 }
Example #6
0
 /// <exception cref="System.Exception"></exception>
 public void Run()
 {
     idSystem.NewId();
 }