public void QuotesQuery_Test()
        {
            CLQuotesResponse response = CLQueryBuilder.
                                        Create(Endpoints.RATES).
                                        SetAccessKey(TestConfiguration.ApiAccessKey).
                                        GetResult <CLQuotesResponse>();

            Assert.IsNotNull(response);
            Assert.IsTrue(response.Success);
        }
        public void SimpleQuery_Test()
        {
            CLManagerSettings settings = new CLManagerSettings
            {
                LogRequestsAndResponses = true,
                FormatResponse          = true
            };

            string response = CLQueryBuilder.
                              Create(Endpoints.CURRENCIES).
                              WithSettings(settings).
                              GetResponse();

            Assert.IsNotNull(response);
        }
Exemplo n.º 3
0
        private async Task <TResult> RequestAsync <TResult>(string endpoint, Dictionary <string, string> parameters)
            where TResult : CLResponse
        {
            var result = await CLQueryBuilder.
                         Create(endpoint).
                         WithSettings(mSettings).
                         WithPolicy(mRequestPolicy).
                         AddParameters(parameters).
                         SetAccessKey(this.mAccessToken).
                         GetResultAsync <TResult>();

            result.ThrowIfError();

            return(result);
        }
        public void CallbackFunctionFeature_Test()
        {
            CLManagerSettings settings = new CLManagerSettings
            {
                LogRequestsAndResponses = true,
                FormatResponse          = true
            };

            string response = CLQueryBuilder.
                              Create(Endpoints.CURRENCIES).
                              AddParameter("callback", "test_callback").
                              WithSettings(settings).
                              GetResponse();

            Assert.IsNotNull(response);
            Assert.IsTrue(response.Contains("test_callback"));
        }