Example #1
0
        public void GetCredential_Password_Success()
        {
            Credential oCredential;
            var        res = Credential.GetCredential(_connectionServer, _tempUser.ObjectId, CredentialType.Password, out oCredential);

            Assert.IsTrue(res.Success, "Failed to fetch password credential manually:" + res.ToString());
        }
Example #2
0
        public void GetCredential_NullConnectionServer_Failure()
        {
            Credential oCredential;

            var res = Credential.GetCredential(null, "UserObjectId", CredentialType.Password, out oCredential);

            Assert.IsFalse(res.Success, "GetCredential should fail with null ConnectionServerRest passed to it");
        }
Example #3
0
        public void GetCredential_EmptyObjectId_Failure()
        {
            Credential oCredential;

            var res = Credential.GetCredential(_mockServer, "", CredentialType.Password, out oCredential);

            Assert.IsFalse(res.Success, "GetCredential should fail with empty UserObjectID  passed to it");
        }
Example #4
0
        public void Credential_Pin_Test()
        {
            _errorString = "";
            Credential oCredential;
            var        res = Credential.GetCredential(_connectionServer, _tempUser.ObjectId, CredentialType.Pin, out oCredential);

            Assert.IsTrue(res.Success, "Failed to fetch pin credentials:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), "Error parsing Json for pin credential:" + _errorString);
        }
        public void StaticCallFailures_GetCredential()
        {
            Credential oCredential;
            var        res = Credential.GetCredential(null, "userid", CredentialType.Password, out oCredential);

            Assert.IsFalse(res.Success, "Calling GetCredential with null Connection server did not fail");

            res = Credential.GetCredential(_connectionServer, "userid", CredentialType.Password, out oCredential);
            Assert.IsFalse(res.Success, "Calling GetCredential with invalid user id did not fail");

            res = Credential.GetCredential(_connectionServer, "", CredentialType.Password, out oCredential);
            Assert.IsFalse(res.Success, "Calling GetCredential with empty user id did not fail");
        }
Example #6
0
        public void GetCredential_ValidResponse_Success()
        {
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), It.IsAny <bool>())).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = "{\"ObjectID\":\"testObjectId\",\"Alias\":\"testAlias\"}"
            });

            Credential oCredential;
            var        res = Credential.GetCredential(_mockServer, "UserObjectId", CredentialType.Pin, out oCredential);

            Assert.IsTrue(res.Success, "GetCredential call failed:" + res);
        }
Example #7
0
        public void GetCredential_EmptyResult_Failure()
        {
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = ""
            });

            Credential oCredential;
            var        res = Credential.GetCredential(_mockServer, "UserObjectId", CredentialType.Password, out oCredential);

            Assert.IsFalse(res.Success, "GetCredential should fail with empty results");
        }
Example #8
0
        public void GetCredential_GarbageResponse_Failure()
        {
            _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"
            });

            Credential oCredential;
            var        res = Credential.GetCredential(_mockServer, "UserObjectId", CredentialType.Password, out oCredential);

            Assert.IsFalse(res.Success, "GetCredential should fail with garbage results");
        }