public void TestEnterConditionLimit()
        {
            int maxLiveSweepCount = 4;
            int maxNewSweepCount = 2;

            EnterConditionLimit enterLimit = new EnterConditionLimit(maxLiveSweepCount, maxNewSweepCount);

            {
                Boolean ok = enterLimit.IsOK(0, 0);
                Assert.AreEqual(ok, true);
            }

            {
                Boolean ok = enterLimit.IsOK(1, 1);
                Assert.AreEqual(ok, true);
            }

            {
                Boolean ok = enterLimit.IsOK(5, 1);
                Assert.AreEqual(ok, false);
            }

            {
                Boolean ok = enterLimit.IsOK(1, 3);
                Assert.AreEqual(ok, false);
            }

            {
                Boolean ok = enterLimit.IsOK(4, 1);
                Assert.AreEqual(ok, false);
            }

            {
                Boolean ok = enterLimit.IsOK(3, 2);
                Assert.AreEqual(ok, false);
            }

            {
                long possibleCount = enterLimit.GetPossibleNewSweeperCountOfEachNode(1);
                Assert.AreEqual(possibleCount, 2);
            }

            {
                long possibleCount = enterLimit.GetPossibleNewSweeperCountOfEachNode(2);
                Assert.AreEqual(possibleCount, 2);
            }

            {
                long possibleCount = enterLimit.GetPossibleNewSweeperCountOfEachNode(3);
                Assert.AreEqual(possibleCount, 1);
            }
            {
                long possibleCount = enterLimit.GetPossibleNewSweeperCountOfEachNode(4);
                Assert.AreEqual(possibleCount, 0);
            }
            {
                long possibleCount = enterLimit.GetPossibleNewSweeperCountOfEachNode(5);
                Assert.AreEqual(possibleCount, 0);
            }
            {
                long possibleCount = enterLimit.GetPossibleNewSweeperCountOfEachNode(0);
                Assert.AreEqual(possibleCount, 2);
            }
            {
                long possibleCount = enterLimit.GetPossibleNewSweeperCountOfEachNode(-1);
                Assert.AreEqual(possibleCount, 2);
            }
        }
        public void InitEnterLimit_6(String maxLiveSweepCount, String maxNewSweepCount)
        {
            _enterLimit = new EnterConditionLimit(
                Util.ConvertFormatStringToInt64(maxLiveSweepCount),
                Util.ConvertFormatStringToInt64(maxNewSweepCount));

            _bReadyEnterLimit = true;
        }
示例#3
0
 public void InitEnterLimit_2(EnterConditionLimit enterLimit)
 {
     this._enterLimit = enterLimit;
 }