public void GetDirectoryHandlers_NullConnectionServer_Failure()
        {
            List <DirectoryHandler> oHandlerList;

            WebCallResult res = DirectoryHandler.GetDirectoryHandlers(null, out oHandlerList, 1, 10, null);

            Assert.IsFalse(res.Success, "GetDirectoryHandler should fail with null ConnectionServerRest passed to it");
        }
Beispiel #2
0
        public void DirectoryHandler_Test()
        {
            _errorString = "";
            List <DirectoryHandler> oDirectoryHandlers;
            var res = DirectoryHandler.GetDirectoryHandlers(_connectionServer, out oDirectoryHandlers, 1, 2);

            Assert.IsTrue(res.Success & oDirectoryHandlers.Count > 0, "Failed to fetch directory handlers:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), "Error parsing Json for directory handlers:" + _errorString);
        }
        public void GetDirectoryHandlers_EmptyResult_Failure()
        {
            Reset();
            _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 <DirectoryHandler> oHandlers;
            var res = DirectoryHandler.GetDirectoryHandlers(_mockServer, out oHandlers, 1, 5, null);

            Assert.IsFalse(res.Success, "Calling GetDirectoryHandlers with EmptyResultText did not fail");
        }
        public void GetDirectoryHandlers_ZeroCount_Success()
        {
            Reset();
            _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 <DirectoryHandler> oHandlers;
            var res = DirectoryHandler.GetDirectoryHandlers(_mockServer, out oHandlers, 1, 5, null);

            Assert.IsTrue(res.Success, "Calling GetDirectoryHandlers with ZeroCount failed:" + res);
        }
        public void GetDirectoryHandlers_ErrorResponse_Failure()
        {
            Reset();
            _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 <DirectoryHandler> oHandlers;
            var res = DirectoryHandler.GetDirectoryHandlers(_mockServer, out oHandlers, 1, 5, null);

            Assert.IsFalse(res.Success, "Calling GetDirectoryHandlers with ErrorResponse did not fail");
        }
        public void GetDirectoryHandlers_GarbageResponse_Failure()
        {
            Reset();
            _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 call handler JSON data"
            });

            List <DirectoryHandler> oHandlers;
            var res = DirectoryHandler.GetDirectoryHandlers(_mockServer, out oHandlers, 1, 5, null);

            Assert.IsFalse(res.Success, "Calling GetDirectoryHandlers with garbage results should fail");
            Assert.IsTrue(oHandlers.Count == 0, "Invalid result text should produce an empty list");
        }
Beispiel #7
0
        public void GetActionDescripiton_DirectoryHandlers()
        {
            List <DirectoryHandler> oDirHandlers;
            var res = DirectoryHandler.GetDirectoryHandlers(_connectionServer, out oDirHandlers, 1, 1);

            Assert.IsTrue(res.Success, "Failed to fetch directory handlers:" + res);
            Assert.IsTrue(oDirHandlers.Count > 0, "Failed to find any directory handlers");

            string strRet = _connectionServer.GetActionDescription(ActionTypes.GoTo, ConversationNames.AD,
                                                                   oDirHandlers[0].ObjectId);

            Assert.IsTrue(strRet.ToLower().Contains("route to name lookup handler:"),
                          "Directory handler route description not correct:" + strRet);

            strRet = _connectionServer.GetActionDescription(ActionTypes.GoTo, ConversationNames.AD, "bogus");
            Assert.IsTrue(strRet.ToLower().Contains("invalid link"),
                          "Directory handler route description not correct for missing link:"
                          + strRet);
        }
Beispiel #8
0
        public void GetDirectoryHandlers_FetchTest()
        {
            List <DirectoryHandler> oHandlerList;
            DirectoryHandler        oNewHandler;

            WebCallResult res = DirectoryHandler.GetDirectoryHandlers(_connectionServer, out oHandlerList, 1, 1);

            Assert.IsTrue(res.Success, "Fetching of first directory handler failed: " + res.ToString());
            Assert.AreEqual(oHandlerList.Count, 1, "Fetching of the first directory handler returned a different number of handlers: " + res.ToString());

            //exercise the ToString and DumpAllProperties as part of this test as well
            foreach (DirectoryHandler oHandler in oHandlerList)
            {
                Console.WriteLine(oHandler.ToString());
                Console.WriteLine(oHandler.DumpAllProps());

                //fetch a new directory handler using the objectId
                res = DirectoryHandler.GetDirectoryHandler(out oNewHandler, _connectionServer, oHandler.ObjectId);
                Assert.IsTrue(res.Success, "Fetching directory handler by ObjectId: " + res.ToString());
            }

            try
            {
                oNewHandler = new DirectoryHandler(_connectionServer, "", oHandlerList[0].DisplayName);
                Console.WriteLine(oNewHandler);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to create new direcotry handler using valid display name for search:" + ex);
            }

            //hit failed searches
            res = DirectoryHandler.GetDirectoryHandler(out oNewHandler, _connectionServer, "", "bogus name that shouldnt match");
            Assert.IsFalse(res.Success, "Fetching directory handler by bogus name did not fail");

            res = DirectoryHandler.GetDirectoryHandlers(_connectionServer, out oHandlerList, 1, 1, "query=(ObjectId is bogus)");
            Assert.IsTrue(res.Success, "fetching handlers with invalid query should not fail:" + res);
            Assert.IsTrue(oHandlerList.Count == 0, "Invalid query string should return an empty handler list:" + oHandlerList.Count);
        }