public void TestGetMonitoringSummaryForAgent()
        {
            Agent agentExpected = agent;
            List <MonitoringType> monitoringTypesExpected = new List <MonitoringType>();

            monitoringTypesExpected.Add(new MonitoringType(1, "sysDesc", "1.3.6.1.2.1.1.1"));
            monitoringTypesExpected.Add(new MonitoringType(9, "sysName", "1.3.6.1.2.1.1.5"));
            monitoringTypesExpected.Add(new MonitoringType(10, "sysUptime", "1.3.6.1.2.1.25.1.1"));
            monitoringTypesExpected.Add(new MonitoringType(11, "cpuUsage", "1.3.6.1.2.1.25.3.3"));
            monitoringTypesExpected.Add(new MonitoringType(12, "hrDiskStorageTable", "1.3.6.1.2.1.25.3.2"));
            KeyValuePair <Agent, List <MonitoringType> > summaryExpected = new KeyValuePair <Agent, List <MonitoringType> >(agentExpected, monitoringTypesExpected);

            int agentNr = 1;
            KeyValuePair <Agent, List <MonitoringType> > summaryActual = controller.GetMonitorSummaryForAgent(agentNr);

            // Test Agent Key
            Assert.AreEqual(1, summaryActual.Key.AgentNr);
            Assert.AreEqual("sinv-56075.edu.hsr.ch", summaryActual.Key.Name);
            Assert.AreEqual("152.96.56.75", summaryActual.Key.IPAddress);
            Assert.AreEqual(1, summaryActual.Key.Type.TypeNr);
            Assert.AreEqual(40001, summaryActual.Key.Port);
            Assert.AreEqual(1, summaryActual.Key.Status);
            Assert.AreEqual("{\n  \"Results\": [\n    {\n      \"OID\": \"1.3.6.1.2.1.1.1.0\",\n      \"Type\": \"OctetString\",\n      \"Value\": \"Hardware: Intel64 Family 6 Model 62 Stepping 4 AT/AT COMPATIBLE - Software: Windows Version 6.3 (Build 9600 Multiprocessor Free)\"\n    }\n  ]\n}".Replace("\n", Environment.NewLine), summaryActual.Key.SysDesc);
            Assert.AreEqual("{\n  \"Results\": [\n    {\n      \"OID\": \"1.3.6.1.2.1.1.5.0\",\n      \"Type\": \"OctetString\",\n      \"Value\": \"sinv-56075\"\n    }\n  ]\n}".Replace("\n", Environment.NewLine), summaryActual.Key.SysName);

            // Test Size of List<MonitoringType>
            Assert.AreEqual(summaryExpected.Value.Count, summaryActual.Value.Count);

            for (int i = 0; i < summaryActual.Value.Count; i++)
            {
                Assert.AreEqual(summaryExpected.Value[i].MonitoringTypeNr, summaryActual.Value[i].MonitoringTypeNr);
                Assert.AreEqual(summaryExpected.Value[i].Description, summaryActual.Value[i].Description);
                Assert.AreEqual(summaryExpected.Value[i].ObjectID, summaryActual.Value[i].ObjectID);
            }
        }
        public CustomJsonResult GetMonitorSummaryForAgent(int id)
        {
            KeyValuePair <Agent, List <MonitoringType> > monitorSummary = new KeyValuePair <Agent, List <MonitoringType> >(null, null);

            try
            {
                SNMPController controller = new SNMPController(Properties.Settings.Default.ProdDatabaseConnectionString);
                monitorSummary = controller.GetMonitorSummaryForAgent(id);
            }
            catch (Exception exc)
            {
                BusinessLayer.ExceptionHandling.ExceptionCore.HandleException(BusinessLayer.ExceptionHandling.ExceptionCategory.Normal, exc);
            }

            return(new CustomJsonResult {
                Data = monitorSummary, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }