示例#1
0
        public List <MonitorData> GetHistoryOfOIDForAgent(int agentNr, string ObjectID, int count)
        {
            List <MonitorData> monitoringDataList = new List <MonitorData>();

            try
            {
                List <MonitorDataDataModel> resultList = _databaseConnection.GetHistoryOfOIDForAgent(agentNr, ObjectID, count);
                foreach (MonitorDataDataModel monitoringData in resultList)
                {
                    monitoringDataList.Add(new MonitorData(monitoringData.Timestamp, monitoringData.Result, monitoringData.AgentNr, monitoringData.ObjectID));
                }
            }
            catch (SqlException e)
            {
                ExceptionCore.HandleException(ExceptionCategory.Fatal, e);
            }
            catch (InvalidCastException e)
            {
                ExceptionCore.HandleException(ExceptionCategory.High, e);
            }
            catch (Exception e)
            {
                ExceptionCore.HandleException(ExceptionCategory.Normal, e);
            }
            return(monitoringDataList);
        }
        public void getHistoryOfOIDForAgent()
        {
            List <MonitorDataDataModel> monitorDataList = databaseConnection.GetHistoryOfOIDForAgent(1, "1.3.6.1.2.1.1.5.0", 10);

            int expected = 10;

            Assert.IsTrue(monitorDataList.Count <= expected);
        }