public void GenerateAggregateResultSetCalculatesAverageAndMaxOnSameVariable() { //setup var variableType = "X"; var sut = new AggregateProcessor(); var avvalues = new List <double>() { 10, 20, 30, 40 }; var maxvalues = new List <double>() { 40, 50, 60, 40 }; sut.AddResults(GetResultSet(new string[] { variableType }, true, true, false, avvalues.ToArray(), maxvalues.ToArray(), null));// //execute var results = sut.GenerateAggregateResultSet(); //assert Assert.IsTrue(results.Any(r => r.VariableType == "X" && r.CalculationType == statisticCalculation.Average.ToString())); Assert.IsTrue(results.Any(r => r.VariableType == "X" && r.CalculationType == statisticCalculation.MaxValue.ToString())); Assert.AreEqual(25, results.First(r => r.VariableType == "X" && r.CalculationType == statisticCalculation.Average.ToString()).Value); Assert.AreEqual(60, results.First(r => r.VariableType == "X" && r.CalculationType == statisticCalculation.MaxValue.ToString()).Value); }
public void GenerateAggregateResultSetCalculatesAverage() { //setup var variableType = "X"; var sut = new AggregateProcessor(); var values = new List <double>() { 10, 20, 30, 40 }; sut.AddResults(GetResultSet(new string[] { variableType }, true, false, false, values.ToArray(), null, null));// //execute var results = sut.GenerateAggregateResultSet(); //assert Assert.AreEqual(25, results.First().Value); Assert.AreEqual(statisticCalculation.Average.ToString(), results.First().CalculationType); Assert.AreEqual(variableType, results.First().VariableType); }