public void ExpandWithCount() { var pool = new PoolCollectionDynamic <Target>(new TargetBuilder()); pool.Expand(8); Assert.AreEqual(8, pool.Count); }
public void TrimWithCount() { var pool = new PoolCollectionDynamic <Target>(new TargetBuilder()); pool.Expand(10); pool.Trim(4); Assert.AreEqual(6, pool.Count); }
public void Enable() { var pool = new PoolCollectionDynamic <Target>(new TargetBuilder()); Target target = pool.Enable(); Assert.NotNull(target); Assert.AreEqual(5, pool.Count); Assert.AreEqual(1, pool.EnabledCount); Assert.AreEqual(4, pool.DisabledCount); }
public void IsExpandRequired() { var pool = new PoolCollectionDynamic <Target>(new TargetBuilder()); for (int i = 0; i < 5; i++) { pool.Enable(); } bool result0 = pool.IsExpandRequired(); Assert.True(result0); }
public void IsTrimRequired() { var pool = new PoolCollectionDynamic <Target>(new TargetBuilder()); pool.Expand(); pool.Add(new Target()); bool result0 = pool.IsTrimRequired(); Assert.True(result0); Assert.AreEqual(6, pool.Count); Assert.AreEqual(0, pool.EnabledCount); Assert.AreEqual(6, pool.DisabledCount); }
public void DisableAll() { var pool = new PoolCollectionDynamic <Target>(new TargetBuilder()); for (int i = 0; i < 6; i++) { pool.Enable(); } Assert.AreEqual(10, pool.Count); Assert.AreEqual(6, pool.EnabledCount); Assert.AreEqual(4, pool.DisabledCount); pool.DisableAll(); Assert.AreEqual(5, pool.Count); Assert.AreEqual(0, pool.EnabledCount); Assert.AreEqual(5, pool.DisabledCount); }
public void Disable() { var pool = new PoolCollectionDynamic <Target>(new TargetBuilder()); var items = new List <Target>(); for (int i = 0; i < 6; i++) { items.Add(pool.Enable()); } Assert.AreEqual(10, pool.Count); Assert.AreEqual(6, pool.EnabledCount); Assert.AreEqual(4, pool.DisabledCount); for (int i = 0; i < items.Count; i++) { pool.Disable(items[i]); } Assert.AreEqual(5, pool.Count); Assert.AreEqual(0, pool.EnabledCount); Assert.AreEqual(5, pool.DisabledCount); }