public void TestGetMonitoringSummary()
        {
            List <KeyValuePair <Agent, List <MonitoringType> > > summaryExpected = new List <KeyValuePair <Agent, List <MonitoringType> > >();

            Agent agentExpected1 = agent;
            List <MonitoringType> listExpected1 = new List <MonitoringType>();

            listExpected1.Add(new MonitoringType(1, "sysDesc", "1.3.6.1.2.1.1.1"));
            listExpected1.Add(new MonitoringType(9, "sysName", "1.3.6.1.2.1.1.5"));
            listExpected1.Add(new MonitoringType(10, "sysUptime", "1.3.6.1.2.1.25.1.1"));
            listExpected1.Add(new MonitoringType(11, "cpuUsage", "1.3.6.1.2.1.25.3.3"));
            listExpected1.Add(new MonitoringType(12, "hrDiskStorageTable", "1.3.6.1.2.1.25.3.2"));

            Agent agentExpected2 = new Agent("Test-Server", "10.10.10.10", new Type(1, "Server"), 161);
            List <MonitoringType> listExpected2 = new List <MonitoringType>();

            listExpected2.Add(new MonitoringType(1, "sysDesc", "1.3.6.1.2.1.1.1"));
            listExpected2.Add(new MonitoringType(9, "sysName", "1.3.6.1.2.1.1.5"));
            listExpected2.Add(new MonitoringType(10, "sysUptime", "1.3.6.1.2.1.25.1.1"));

            summaryExpected.Add(new KeyValuePair <Agent, List <MonitoringType> >(agentExpected1, listExpected1));
            summaryExpected.Add(new KeyValuePair <Agent, List <MonitoringType> >(agentExpected2, listExpected2));

            controller.AddAgentToDatabase(agentExpected2, false, false);

            List <KeyValuePair <Agent, List <MonitoringType> > > summaryActual = controller.GetMonitoringSummary();

            Assert.AreEqual(summaryExpected.Count, summaryActual.Count);

            for (int i = 0; i < summaryActual.Count; i++)
            {
                //Test Key (Agent)
                Assert.AreEqual(summaryExpected[i].Key.IPAddress, summaryActual[i].Key.IPAddress);
                Assert.AreEqual(summaryExpected[i].Key.Name, summaryActual[i].Key.Name);
                Assert.AreEqual(summaryExpected[i].Key.Port, summaryActual[i].Key.Port);
                Assert.AreEqual(summaryExpected[i].Key.Status, summaryActual[i].Key.Status);
                Assert.AreEqual(summaryExpected[i].Key.Type.TypeNr, summaryActual[i].Key.Type.TypeNr);

                //Test Value (List<MonitoringType>)
                for (int j = 0; j < summaryActual[i].Value.Count; j++)
                {
                    Assert.AreEqual(summaryExpected[i].Value[j].MonitoringTypeNr, summaryActual[i].Value[j].MonitoringTypeNr);
                    Assert.AreEqual(summaryExpected[i].Value[j].Description, summaryActual[i].Value[j].Description);
                    Assert.AreEqual(summaryExpected[i].Value[j].ObjectID, summaryActual[i].Value[j].ObjectID);
                }
            }

            //Delete added agent for testcase
            List <Agent> agents          = controller.GetAgents();
            int          newAddedAgentNr = agents[agents.Count - 1].AgentNr;

            controller.DeleteAgent(newAddedAgentNr);
        }
        public CustomJsonResult GetMonitorSummary()
        {
            List <KeyValuePair <Agent, List <MonitoringType> > > monitorSummary = null;

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

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