Esempio n. 1
0
        public void GetPortGroupTemplates_NullConnectionServer_Failure()
        {
            List <PortGroupTemplate> oList;
            WebCallResult            res = PortGroupTemplate.GetPortGroupTemplates(null, out oList);

            Assert.IsFalse(res.Success, "Static call to GetPortGroupTemplates did not fail with: null ConnectionServer");
        }
        private PortGroupTemplate HelperGetPortGroupTemplate()
        {
            List <PortGroupTemplate> oList;
            WebCallResult            res = PortGroupTemplate.GetPortGroupTemplates(_connectionServer, out oList);

            Assert.IsTrue(res.Success, "Static call to GetPortGroupTemplates failed:" + res);
            Assert.IsTrue(oList.Count > 0, "No port group templates found");
            return(oList[0]);
        }
Esempio n. 3
0
        public void PortGroupTemplate_Test()
        {
            _errorString = "";
            List <PortGroupTemplate> oPortGroupTemplates;
            var res = PortGroupTemplate.GetPortGroupTemplates(_connectionServer, out oPortGroupTemplates);

            Assert.IsTrue(res.Success & oPortGroupTemplates.Count > 0, "Failed to fetch portgrouptemplates:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);
        }
Esempio n. 4
0
        public void GetPortGroupTemplates_ZeroCount_Success()
        {
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success          = true,
                ResponseText     = "junk text",
                TotalObjectCount = 0
            });

            List <PortGroupTemplate> oTemplates;
            var res = PortGroupTemplate.GetPortGroupTemplates(_mockServer, out oTemplates);

            Assert.IsTrue(res.Success, "Calling GetPortGroupTemplates with ZeroCount failed:" + res);
        }
Esempio n. 5
0
        public void GetPortGroupTemplates_ErrorResponse_Failure()
        {
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = false,
                ResponseText = "error text",
                StatusCode   = 404
            });

            List <PortGroupTemplate> oTemplates;
            var res = PortGroupTemplate.GetPortGroupTemplates(_mockServer, out oTemplates);

            Assert.IsFalse(res.Success, "Calling GetPortGroupTemplates with ErrorResponse did not fail");
        }
Esempio n. 6
0
        public void GetPortGroupTemplates_EmptyResult_Failure()
        {
            _mockTransport.Setup(
                x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                       It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = ""
            });

            List <PortGroupTemplate> oTemplates;
            var res = PortGroupTemplate.GetPortGroupTemplates(_mockServer, out oTemplates);

            Assert.IsFalse(res.Success, "Calling GetPortGroupTemplates with EmptyResultText did not fail");
        }
Esempio n. 7
0
        public void GetPortGroupTemplates_GarbageResponse_Failure()
        {
            BaseUnitTests.ClassInitialize(null);

            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), It.IsAny <bool>())).Returns(new WebCallResult
            {
                Success          = true,
                TotalObjectCount = 1,
                ResponseText     = "garbage result that will not be parsed out as call handler JSON data"
            });

            List <PortGroupTemplate> oTemplates;
            var res = PortGroupTemplate.GetPortGroupTemplates(_mockServer, out oTemplates);

            Assert.IsFalse(res.Success, "Calling GetPortGroupTemplates with garbage results should fail");
            Assert.IsTrue(oTemplates.Count == 0, "Invalid result text should produce an empty list");
        }