private void PrintMode(List<decimal> numbers) { try { var modeCalc = new ModeCalculator(); var mode = modeCalc.CalculateMode(numbers); Console.WriteLine("Mode: {0}", mode); } catch (Exception) { Console.WriteLine("Mode: ERROR"); } }
public void CalculateModeReturnsNothing() { var modeCalculator = new ModeCalculator(); var testData = new List<decimal>(); modeCalculator.CalculateMode(testData); }
public void CalculateModeReturnsMostCommon() { var modeCalculator = new ModeCalculator(); var testData = new List<decimal>(); testData.Add(1); testData.Add(1); testData.Add(2); testData.Add(3); testData.Add(3); testData.Add(3); var mode = modeCalculator.CalculateMode(testData); Assert.AreEqual("3", mode); }
public void CalculateModeReturnsMostCommon2() { var modeCalculator = new ModeCalculator(); var testData = new List<decimal>(); testData.Add(199); testData.Add(254); testData.Add(199); testData.Add(233); testData.Add(998); testData.Add(199); var mode = modeCalculator.CalculateMode(testData); Assert.AreEqual("199", mode); }