public void MedianFalseTest2() {//This test for finding median is done for list containing odd count of values. ListManipulation LM = new ListManipulation(); ExcelFormulas ef = new ExcelFormulas(); try { List <double> values = new List <double> { 45, 10, 78, 1, 56 }; List <double> sortedList = LM.GetAscendedList(values); double Result = ef.GetMedian(sortedList); Assert.AreEqual(56, Result); } catch (Exception ex) { throw ex; } }
public void MedianTrueTest1() {//This test for finding median is done for list containing even count of values. ListManipulation LM = new ListManipulation(); ExcelFormulas ef = new ExcelFormulas(); try { List <double> values = new List <double> { 45, 10, 78, 1 }; List <double> sortedList = LM.GetAscendedList(values); //Sorted List is passed because number needs to be arranged in order. double Result = ef.GetMedian(sortedList); Assert.AreEqual(27.5, Result); } catch (Exception ex) { throw ex; } }