示例#1
0
        public void CalculateMedianReturnsExceptionForEmptyList()
        {
            var medianCalculator = new MedianCalculator();

            var testData = new List<decimal>();

            medianCalculator.CalculateMedian(testData);
        }
示例#2
0
        private void PrintMedian(List<decimal> numbers)
        {
            var medianCalc = new MedianCalculator();
            var median = medianCalc.CalculateMedian(numbers);

            Console.Write("Median: {0}", median);

            Console.WriteLine();
        }
示例#3
0
        public void CalculateMedianReturnsOneNumber()
        {
            var medianCalculator = new MedianCalculator();

            var testData = new List<decimal>();
            testData.Add(1);
            testData.Add(2);
            testData.Add(3);

            var median = medianCalculator.CalculateMedian(testData);

            Assert.AreEqual("2", median);
        }
示例#4
0
        public void CalculateMedianReturnsTwoNumbers()
        {
            var medianCalculator = new MedianCalculator();

            var testData = new List<decimal>();
            testData.Add(22);
            testData.Add(44);
            testData.Add(56);
            testData.Add(100);

            var median = medianCalculator.CalculateMedian(testData);

            Assert.AreEqual("50", median);
        }