コード例 #1
0
        /// <summary>
        /// Gets the median value of the elements in the MedianSlider.
        /// </summary>
        ///
        /// <returns>
        /// The median value of the elements in the MedianSlider,
        /// if the number of elements in the MedianSlider is equal to the slider size.
        /// Otherwise,the last element in the MedianSlider.
        /// </returns>
        public float GetMedianValue()
        {
            if (!SliderFilled)
            {
                return((float)slider.GetLast());
            }

            var sortedSlider = slider.GetSorted();

            return((float)sortedSlider[medianIndex]);
        }
コード例 #2
0
        public void TestGetLast()
        {
            AddFloats();

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

                Assert.AreEqual(enhancedArrayList[enhancedArrayList.Count - 1], lastFloat);

                enhancedArrayList.RemoveAt(enhancedArrayList.Count - 1);
            }

            Assert.IsEmpty(enhancedArrayList);
        }