Exemplo n.º 1
0
        public void GetPrivateLists_EmptyOwnerObjectId_Failure()
        {
            List <PrivateList> oLists;
            WebCallResult      res = PrivateList.GetPrivateLists(_mockServer, "", out oLists);

            Assert.IsFalse(res.Success, "Fetching private lists with empty owner objectId did not fail");
        }
        public void GetPrivateLists_Success()
        {
            List <PrivateList> oLists;
            var res = PrivateList.GetPrivateLists(_connectionServer, _tempUser.ObjectId, out oLists);

            Assert.IsTrue(res.Success, "Failed fetching private lists for user:" + res);
        }
Exemplo n.º 3
0
        public void GetPrivateLists_NullConnectionServer_Failure()
        {
            List <PrivateList> oLists;
            WebCallResult      res = PrivateList.GetPrivateLists(null, "blah", out oLists);

            Assert.IsFalse(res.Success, "Fetching private lists with null ConnectionServerRest did not fail");
        }
Exemplo n.º 4
0
        public void PrivateList_Test()
        {
            PrivateList oList;
            var         res = PrivateList.AddPrivateList(_connectionServer, _tempUser.ObjectId, "Test list 1", 1, out oList);

            Assert.IsTrue(res.Success, "Failed to create private list for user:"******"Failed to add member to private list");

            _errorString = "";
            List <PrivateList> oPrivateLists;

            res = PrivateList.GetPrivateLists(_connectionServer, _tempUser.ObjectId, out oPrivateLists, 1, 2);
            Assert.IsTrue(res.Success & oPrivateLists.Count > 0, "Failed to fetch private lists:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);

            //private list member
            foreach (var oPrivateList in oPrivateLists)
            {
                List <PrivateListMember> oPrivateListMembers;
                res = PrivateList.GetMembersList(_connectionServer, oPrivateList.ObjectId, _tempUser.ObjectId,
                                                 out oPrivateListMembers);
                Assert.IsTrue(res.Success & oPrivateLists.Count > 0, "Failed to fetch private list members:" + res);
                if (oPrivateListMembers.Count > 0)
                {
                    break;
                }
            }

            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);
        }
Exemplo n.º 5
0
        public void GetPrivateLists_GarbageResults_Success()
        {
            //garbage response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = "garbage result"
            });
            List <PrivateList> oLists;
            var res = PrivateList.GetPrivateLists(_mockServer, "InvalidResultText", out oLists);

            Assert.IsTrue(res.Success, "Calling GetPrivateLists with InvalidResultText should not fail:" + res);
            Assert.IsTrue(oLists.Count == 0, "Invalid result text should result in empty list returned");
        }
Exemplo n.º 6
0
        public void GetPrivateLists_ErrorResponse_Failure()
        {
            //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 <PrivateList> oLists;
            var res = PrivateList.GetPrivateLists(_mockServer, "ErrorResponse", out oLists);

            Assert.IsFalse(res.Success, "Calling GetPrivateLists with ErrorResponse did not fail");
            Assert.IsTrue(oLists.Count == 0, "Error result should result in empty list returned");
        }
Exemplo n.º 7
0
        public void GetPrivateLists_EmptyResults_Failure()
        {
            //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 <PrivateList> oLists;
            var res = PrivateList.GetPrivateLists(_mockServer, "EmptyResultText", out oLists);

            Assert.IsFalse(res.Success, "Calling GetPrivateLists with EmptyResultText did not fail");
            Assert.IsTrue(oLists.Count == 0, "Empty result text should result in empty list returned");
        }