Ejemplo n.º 1
0
        public double FunctionOperation(string calculation, IList <double> values)
        {
            double        result = 0;
            FormulaClass  fc     = new FormulaClass();
            List <double> value  = fc.SortedList(values);

            switch (calculation.ToLower())
            {
            case "sum":
                result = fc.Sum_Formula(value);
                break;

            case "median":
                result = fc.Median_Formula(value);
                break;

            case "mean":
                result = fc.Mean_Formula(value);
                break;

            case "mode":
                result = fc.Mode_Formula(value);
                break;

            case "average":
                result = fc.Average_Formula(value);
                break;

            case "*":
                result = fc.Multiply(value);
                break;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public void FailTestMultiply()
        {
            DipeshLama_Spreadsheet_Assignment.FormulaClass f = new DipeshLama_Spreadsheet_Assignment.FormulaClass();
            List <double> values = new List <double> {
                5, 20
            };
            double Result = f.Multiply(values);

            Assert.AreEqual(200, Result);
        }