Пример #1
0
        public void AverageDeltaTest6_FilledTons()
        {
            int maxCapacity           = 10;
            RevolvingDoorTimer target = new RevolvingDoorTimer(maxCapacity);

            // Add numbers to throw it off, then add max numbers to overwrite this value
            for (int i = 0; i < 5000; i++)
            {
                target.AddTick(i * 5);
            }

            int total = 0;

            for (int i = 0; i < maxCapacity; i++)
            {
                target.AddTick(i);
                total += i;
            }

            float expected = 1f;
            float actual;

            actual = target.AverageDelta();
            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void AverageDeltaTest1_None()
        {
            int maxCapacity           = 10;
            RevolvingDoorTimer target = new RevolvingDoorTimer(maxCapacity);
            float expected            = 0f;
            float actual;

            actual = target.AverageDelta();
            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void AverageDeltaTest2_One()
        {
            int maxCapacity           = 10;
            RevolvingDoorTimer target = new RevolvingDoorTimer(maxCapacity);
            int   valueToAdd          = 5;
            float expected            = 0f;
            float actual;

            target.AddTick(valueToAdd);
            actual = target.AverageDelta();
            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void AverageDeltaTest4_Filled()
        {
            int maxCapacity           = 10;
            RevolvingDoorTimer target = new RevolvingDoorTimer(maxCapacity);

            int total = 0;

            for (int i = 0; i < maxCapacity; i++)
            {
                target.AddTick(i);
                total += i;
            }

            float expected = 1f;
            float actual;

            actual = target.AverageDelta();
            Assert.AreEqual(expected, actual);
        }