示例#1
0
    override protected void RemoveInactiveTypes()
    {
        var eliminatedTypes = GetEliminatedTypes();

        if (eliminatedTypes.Count > 0)
        {
            RemoveTypes(eliminatedTypes);
            bag.Clear();

            if ((currentBucket != queueDefinition.reserve) &&
                (currentBucket.counts.Where(x => x > 0).ToList().Count < 3))
            {
                var cycleLength = currentBucket.counts.Sum();

                if (currentBucket.mandatory && (currentCount <= cycleLength))
                {
                    currentBucket.length = cycleLength;
                }
                else
                {
                    SetCurrentBucket();
                }
            }
        }
    }
    public void BagCanBeCleared()
    {
        var bag = new RandomBag <int>(new[] { 1, 2, 3 });

        Assert.IsFalse(bag.Empty);

        bag.Clear();

        Assert.IsTrue(bag.Empty);
        Assert.AreEqual(0, bag.Count);
    }