示例#1
0
        public void TestGetReturnType()
        {
            CalculatedMetricController cm = new CalculatedMetricController();

            cm.IsTest = true;
            var list = cm.Get("TESTMAC", DateTime.Now, MethodesGlobales.GoodDateAdd(DateTime.Now, 50), 1, "9:m");

            Assert.IsNotNull(list);
        }
示例#2
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)
             * }
             *  );*/
        }