コード例 #1
0
        public void GetPortGroups_Success()
        {
            List <PortGroup> oPortGroups;
            WebCallResult    res = PortGroup.GetPortGroups(_connectionServer, out oPortGroups);

            Assert.IsTrue(res.Success, "Failed to fetch port groups:" + res);
            Assert.IsTrue(oPortGroups.Count > 0, "No port groups found on Connection server:" + res);
        }
コード例 #2
0
        public void GetPortGroups_NullConnectionServer_Failure()
        {
            List <PortGroup> oPortGroups;

            WebCallResult res = PortGroup.GetPortGroups(null, out oPortGroups);

            Assert.IsFalse(res.Success, "Fetching port groups with null Connection server should fail.");
        }
コード例 #3
0
        public void GetPortGroups_EmptyConnectionServer_Failure()
        {
            List <PortGroup> oPortGroups;

            var res = PortGroup.GetPortGroups(new ConnectionServerRest(new RestTransportFunctions()), out oPortGroups);

            Assert.IsFalse(res.Success, "Fetching port groups with invalid Connection server should fail.");
        }
コード例 #4
0
        private PortGroup GetPortGroup()
        {
            List <PortGroup> oPortGroups;
            WebCallResult    res = PortGroup.GetPortGroups(_connectionServer, out oPortGroups);

            Assert.IsTrue(res.Success, "Fetching port groups failed:" + res);
            Assert.IsTrue(oPortGroups.Count > 0, "No port groups found");
            return(oPortGroups[0]);
        }
コード例 #5
0
        public void GetPortGroups_EmptyMediaSwitchObjectId_Failure()
        {
            List <PortGroup> oPortGroups;

            var res = PortGroup.GetPortGroups(_mockServer, out oPortGroups, "");

            Assert.IsFalse(res.Success, "Fetching port groups with empty MediaSwitchObjectId should fail.");
            Assert.IsTrue(oPortGroups.Count == 0, "Fetching port groups with empty MediaSwitchObjectId should return an empty list");
        }
コード例 #6
0
        private PortGroup HelperGetPortGroup()
        {
            List <PortGroup> oPortGroups;
            WebCallResult    res = PortGroup.GetPortGroups(_connectionServer, out oPortGroups);

            Assert.IsTrue(res.Success, "Failed to fetch port groups:" + res);
            Assert.IsTrue(oPortGroups.Count > 0, "No port groups found on Connection server:" + res);

            return(oPortGroups[0]);
        }
コード例 #7
0
        public void GetPortGroups_EmptyResult_Failure()
        {
            Reset();
            //empty results
            _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 <PortGroup> oPortGroups;
            var res = PortGroup.GetPortGroups(_mockServer, out oPortGroups, 1, 10, "");

            Assert.IsFalse(res.Success, "Calling GetPortGroups with EmptyResultText did not fail");
        }
コード例 #8
0
        public void GetPortGroups_MediaSwitchObjectId_ErrorResponse_Failure()
        {
            Reset();
            //error response
            _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 <PortGroup> oPortGroups;
            var res = PortGroup.GetPortGroups(_mockServer, out oPortGroups, "MediaSwitchObjectId");

            Assert.IsFalse(res.Success, "Calling GetPortGroups with ErrorResponse did not fail");
        }
コード例 #9
0
        public void GetPortGroups_ZeroCount_Success()
        {
            Reset();
            //error response
            _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 <PortGroup> oPortGroups;
            var res = PortGroup.GetPortGroups(_mockServer, out oPortGroups, 1, 10, "");

            Assert.IsTrue(res.Success, "Calling GetPortGroups with ZeroCount failed:" + res);
        }
コード例 #10
0
        public void GetPortGroups_GarbageResponse_Failure()
        {
            Reset();
            //garbage response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success          = true,
                TotalObjectCount = 1,
                ResponseText     = "garbage result that will not be parsed out as port group JSON data"
            });

            List <PortGroup> oPortGroups;
            var res = PortGroup.GetPortGroups(_mockServer, out oPortGroups, 1, 10, null);

            Assert.IsFalse(res.Success, "Calling GetPortGroups with garbage results should fail");
            Assert.IsTrue(oPortGroups.Count == 0, "Invalid result text should produce an empty list");
        }
コード例 #11
0
        public void PortGroup_Test()
        {
            _errorString = "";
            List <PortGroup> oPortGroups;
            var res = PortGroup.GetPortGroups(_connectionServer, out oPortGroups, 1, 2);

            Assert.IsTrue(res.Success & oPortGroups.Count > 0, "Failed to fetch port groups:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);

            //PortGroupCodec
            List <PortGroupCodec> oPortGroupCodecs;

            res = PortGroupCodec.GetPortGroupCodecs(_connectionServer, oPortGroups[0].ObjectId, out oPortGroupCodecs);
            Assert.IsTrue(res.Success & oPortGroupCodecs.Count > 0, "Failed to fetch port group codecs:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);

            //PortGroupServer
            List <PortGroupServer> oPortGroupServers;

            res = PortGroupServer.GetPortGroupServers(_connectionServer, oPortGroups[0].ObjectId, out oPortGroupServers);
            Assert.IsTrue(res.Success & oPortGroupServers.Count > 0, "Failed to fetch port group server:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);
        }