Ejemplo n.º 1
0
        public void TestMedian()
        {
            CalculGestion cg       = new CalculGestion();
            List <int>    myValues = new List <int>(new int[] { 4, 8, 12 });

            Assert.AreEqual(8, cg.CalcMedian(myValues));
        }
Ejemplo n.º 2
0
        public void TestMoyenne()
        {
            CalculGestion cg       = new CalculGestion();
            List <int>    myValues = new List <int>(new int[] { 5, 5, 5 });
            int           total    = 0;

            foreach (int i in myValues)
            {
                total = total + i;
            }
            Assert.AreEqual(5, cg.CalcMoyenne(myValues.Count(), total));
        }
Ejemplo n.º 3
0
        // GET: api/CalculatedMetric/5
        //string macaddress, DateTime dateDebut, DateTime dateFin, int calculationtype, string step
        public List <CalculatedMetric> Get(string macaddress, DateTime dateDebut, DateTime dateFin, int calculationtype, string step)
        {
            CalculGestion cg = new CalculGestion();

            if (IsTest)
            {
                DataGenerator dg = new DataGenerator(15000);
                list_calc = dg.list;
                return(cg.getRealCalculatedMetrics(list_calc, step, DateTime.Now, MethodesGlobales.GoodDateAdd(DateTime.Now, 50), calculationtype));
            }
            else
            {
                GetDataFromDB(macaddress, dateDebut, dateFin, calculationtype);
                return(cg.getRealCalculatedMetrics(list_calc, step, dateDebut, dateFin, calculationtype));
            }

            /*list_calc.Add(new CalculatedMetric
             * {
             *  Calculated_Metric_Value = "25",
             *  DateStart = DateTime.Now.AddMinutes(2),
             *  DateEnd = DateTime.Now.AddMinutes(7)
             * }
             *  );*/
        }