public void CalculateMedianReturnsExceptionForEmptyList()
        {
            var medianCalculator = new MedianCalculator();

            var testData = new List<decimal>();

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

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

            Console.WriteLine();
        }
        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);
        }
        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);
        }