public void MixedIntegers() { PlanningPoker pp = new PlanningPoker(); Int32[] values = new Int32[] { -1, 2 - 3, 4, 5, 6, 7, 8, -9, 10 }; Int32 answser = pp.GetMedian((Int32[])values); Assert.AreEqual(6, answser); }
public void NegativeIntergers() { PlanningPoker pp = new PlanningPoker(); Int32[] values = new Int32[] { -1, -2, -3, -4, -5, -6, -7, -8, -9, -10 }; Int32 anwser = pp.GetMedian((Int32[])values); Assert.AreEqual(-6, anwser); }
public void PositiveIntergers() { PlanningPoker pp = new PlanningPoker(); Int32[] values = new Int32[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; Int32 anwser = pp.GetMedian((Int32[])values); Assert.AreEqual(6, anwser); }
public void OneIntergers() { PlanningPoker pp = new PlanningPoker(); Int32[] values = new Int32[] { 7 }; Int32 anwser = pp.GetMedian((Int32[])values); Assert.AreEqual(7, anwser); }
protected void btnGetStats_Click(object sender, EventArgs e) { PlanningPokerLib.PlanningPoker ppLib = new PlanningPokerLib.PlanningPoker(); ArrayList Values = new ArrayList(); //seperators fro txt box values char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; string rawValues = txtValues.Text; //array of the split values string[] stringValues = rawValues.Split(delimiterChars); //iterates through the stringValues aray converting to a double and then adding to the median Values Array list foreach (var val in stringValues) { string value = val; Values.Add(Convert.ToInt32(value)); } //median Int32 median = ppLib.GetMedian((Int32[])Values.ToArray(typeof(Int32))); lblMedian.Text = median.ToString(); //mean Int32 mean = ppLib.GetMean((Int32[])Values.ToArray(typeof(Int32))); lblMean.Text = mean.ToString(); //mode Int32 mode = ppLib.GetMode((Int32[])Values.ToArray(typeof(Int32))); lblMode.Text = mode.ToString(); //max Int32 max = ppLib.GetMax((Int32[])Values.ToArray(typeof(Int32))); lblMax.Text = max.ToString(); //min Int32 min = ppLib.GetMin((Int32[])Values.ToArray(typeof(Int32))); lblMin.Text = min.ToString(); //standard deviation Int32 standardDeviation = ppLib.GetStandardDeviation((Int32[])Values.ToArray(typeof(Int32))); lblStandardDeviation.Text = standardDeviation.ToString(); }