Esempio n. 1
0
        public void TestPopFirst()
        {
            AddFloats();

            // Make sure that the initial size of the list is correct
            int expectedSize = ExpectedListSize;

            Assert.AreEqual(expectedSize, enhancedArrayList.Count);

            for (var i = 0; i < ExpectedListSize; i++)
            {
                enhancedArrayList.PopFirst();

                /* Make sure that when the first element is popped, the list just contains the later
                 * elements and has decreased in size by 1 */
                expectedSize--;
                Assert.AreEqual(expectedSize, enhancedArrayList.Count);

                for (var j = 0; j < expectedSize; j++)
                {
                    Assert.AreEqual(floatList[j + i + 1], enhancedArrayList[j]);
                }
            }

            Assert.IsEmpty(enhancedArrayList);
        }
Esempio n. 2
0
        /// <summary>
        /// Inserts a new value into the MedianSlider.
        /// If the number of elements already inserted is equal to the size of the slider,
        /// then the value in the slider that was inserted first chronologically will be popped.
        /// Otherwise, the value is just inserted into the MedianSlider.
        /// </summary>
        ///
        /// <param name="value">The value being inserted into the MedianSlider</param>
        public void Insert(float value)
        {
            if (SliderFilled)
            {
                slider.PopFirst();
            }

            slider.Add(value);
        }