public void Test_ExecuteBearerToken_ToUpdate_TheGlobalBearerToken()
        {
            try
            {
                HttpRequestClient httpRequestClient = TestHelper.InitializeHttpRequestClientWithCorrectCredential();
                string            bearerToken       = httpRequestClient.ExecuteBearerTokenRequest().GetAwaiter().GetResult();

                // Check that the Bearer Token generated is equal to the one in the global variable
                Assert.AreEqual(bearerToken, httpRequestClient.BearerToken);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 public void Test_ExecuteBearerToken_WithWrongCredential()
 {
     try
     {
         HttpRequestClient httpRequestClient = TestHelper.InitializeHttpRequestClientWithCorrectCredential();
         string            bearerToken       = httpRequestClient.ExecuteBearerTokenRequest().GetAwaiter().GetResult();
     }
     catch (XenteIncorrectRequestException ex)
     {
         Assert.AreEqual("Incorrect Authentication Credentials", ex.Message);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        public void Test_TheGeneratedToken_shouldBe_UsedFor_SubsequentRequest()
        {
            try
            {
                HttpRequestClient httpRequestClient = TestHelper.InitializeHttpRequestClientWithCorrectCredential();

                // Generate a token a keep it in variable generatedBearerToken
                string generatedBearerToken = httpRequestClient.ExecuteBearerTokenRequest().GetAwaiter().GetResult();

                // Make request to the API (e.g. create transaction, get transaction etc.)
                AccountResponse accountResults = httpRequestClient.ExecuteAccountRequest("256784378515").GetAwaiter().GetResult();

                string bearerTokenUsedForRetrievingAccountDetails = httpRequestClient.BearerToken;

                // Check that the two bearer tokens are the same
                Assert.AreEqual(generatedBearerToken, bearerTokenUsedForRetrievingAccountDetails);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }