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; } }
private void ManipulateListBox(VisualCopy vc, ListManipulation listManipulation) { try { // Wait until it is safe to enter. mut.WaitOne(); if (listManipulation == ListManipulation.Add) { listbox1.Dispatcher.Invoke(() => { listbox1.Items.Add(vc); }); } else if (listManipulation == ListManipulation.Remove) { listbox1.Dispatcher.Invoke(() => { listbox1.Items.Remove(vc); }); } // Release the Mutex. mut.ReleaseMutex(); } catch (Exception ex) { MessageBox.Show(Error.GetErrorLog(ex.Message, "NeathCopy", "ContainerWindow", "ManipulateListBox")); } }