Exemplo n.º 1
0
        public void GetDirectoryHandler_BlankNameAndObjectId_Failure()
        {
            DirectoryHandler oHandler;
            var res = DirectoryHandler.GetDirectoryHandler(out oHandler, _mockServer);

            Assert.IsFalse(res.Success, "GetDirectoryHandler should fail if the ObjectId and display name are both blank");
        }
Exemplo n.º 2
0
        public void StaticCallFailures_GetDirectoryHandler()
        {
            DirectoryHandler oHandler;

            var res = DirectoryHandler.GetDirectoryHandler(out oHandler, _connectionServer);

            Assert.IsFalse(res.Success, "GetDirectoryHandler should fail if the ObjectId and display name are both blank");
        }
Exemplo n.º 3
0
        public void GetDirectoryHandler_NullConnectionServer_Failure()
        {
            DirectoryHandler oHandler;

            WebCallResult res = DirectoryHandler.GetDirectoryHandler(out oHandler, null);

            Assert.IsFalse(res.Success, "GetDirectoryHandler should fail if the ConnectionServerRest is null");
        }
Exemplo n.º 4
0
        public void GetDirectoryHandler_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
            });

            DirectoryHandler oHandler;
            var res = DirectoryHandler.GetDirectoryHandler(out oHandler, _mockServer, "ObjectId");

            Assert.IsFalse(res.Success, "Calling GetDirectoryHandler with ErrorResponse did not fail");
        }
Exemplo n.º 5
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);
        }