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()); }
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"); }
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"); }
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"); }
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); }
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"); }
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"); }