예제 #1
0
        public void GetUser_Alias_Failure()
        {
            GlobalUser oGlobalUser;
            var        res = GlobalUser.GetUser(out oGlobalUser, _mockServer, "", "bogus alias");

            Assert.IsFalse(res.Success, "Calling GetUser with invalid alias did not fail:");
        }
예제 #2
0
        public void GlobalUser_GetUser()
        {
            GlobalUser        oNewUser;
            List <GlobalUser> oUsers;

            WebCallResult res = GlobalUser.GetUsers(_connectionServer, out oUsers, 1, 10);

            Assert.IsTrue(res.Success, "Failed to fetch global users");
            Assert.IsTrue(oUsers.Count > 0, "No global users returned on fetch");

            //GetUser
            res = GlobalUser.GetUser(out oNewUser, _connectionServer, "");
            Assert.IsFalse(res.Success, "Fetching user with static method with empty objectId did not fail");

            res = GlobalUser.GetUser(out oNewUser, null, "bogus");
            Assert.IsFalse(res.Success, "Fetching user with static method with null Connection server did not fail");

            res = GlobalUser.GetUser(out oNewUser, _connectionServer, "bogus");
            Assert.IsFalse(res.Success, "Fetching user with static method with invalid objectId did not fail");

            res = GlobalUser.GetUser(out oNewUser, _connectionServer, oUsers[0].ObjectId);
            Assert.IsTrue(res.Success, "Failed to fetch a user by valid ObjectId:" + res);

            res = GlobalUser.GetUser(out oNewUser, _connectionServer, "", oUsers[0].Alias);
            Assert.IsTrue(res.Success, "Failed to fetch a user by valid Alias:" + res);
        }
예제 #3
0
        public void GetUser_EmptyAliasAndObjectId_Failure()
        {
            GlobalUser oGlobalUser;
            var        res = GlobalUser.GetUser(out oGlobalUser, _mockServer, "");

            Assert.IsFalse(res.Success, "Calling GetUser with empty alias and ObjectId server should fail");
        }
예제 #4
0
        public void GetUser_NullConnectionServer_Failure()
        {
            GlobalUser oGlobalUser;
            var        res = GlobalUser.GetUser(out oGlobalUser, null, "ObjectId", "Alias");

            Assert.IsFalse(res.Success, "Calling GetUser with null Connection server should fail");
        }
예제 #5
0
        public void GetUser_ObjectId_Success()
        {
            Reset();
            GlobalUser oGlobalUser;
            var        res = GlobalUser.GetUser(out oGlobalUser, _mockServer, Guid.NewGuid().ToString());

            Assert.IsTrue(res.Success, "Calling GetUser with objectId failed:" + res);
        }
예제 #6
0
        public void GetUser_GarbageResult_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 in the response body that will not parse properly to globalUser"
            });

            GlobalUser oUser;
            var        res = GlobalUser.GetUser(out oUser, _mockServer, "objectid");

            Assert.IsFalse(res.Success, "Calling GetUser with garbage result did not fail");
        }
예제 #7
0
        public void GetUser_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 = ""
            });

            GlobalUser oUser;
            var        res = GlobalUser.GetUser(out oUser, _mockServer, "objectid");

            Assert.IsFalse(res.Success, "Calling GetUser with EmptyResultText did not fail");
        }