public void TestSetup()
        {
            controller = new SNMPController(Properties.Settings.Default.TestDatabase);

            List <Agent> agents = controller.GetAgents();

            if (agents.Count == 0)
            {
                controller.AddAgentToDatabase(agent, false, false);
            }
        }
        public CustomJsonResult GetAgents()
        {
            List <Agent> agents = null;

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

            return(new CustomJsonResult {
                Data = agents, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public void TestGetAgents()
        {
            List <Agent> agents = controller.GetAgents();

            if (agents.Count > 0)
            {
                Agent testAgent = agents[0];
                Assert.AreEqual(1, testAgent.AgentNr);
                Assert.AreEqual("sinv-56075.edu.hsr.ch", testAgent.Name);
                Assert.AreEqual("152.96.56.75", testAgent.IPAddress);
                Type testAgentType = testAgent.Type;
                Assert.AreEqual(1, testAgentType.TypeNr);
                Assert.AreEqual(40001, testAgent.Port);
                Assert.AreEqual(1, testAgent.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), testAgent.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), testAgent.SysName);
            }

            Assert.AreEqual(1, agents.Count);
        }