Exemplo n.º 1
0
        public void getClientTest()
        {
            HttpClientClass clientClass = new HttpClientClass();
            HttpClient      client      = clientClass.getClient();

            Assert.IsNotNull(client);
        }
Exemplo n.º 2
0
        private async Task <HttpResponseMessage> httpCall(User user)
        {
            string location = null;
            HttpResponseMessage responce = null;

            try
            {
                HttpClientClass httpClientClass = new HttpClientClass();
                HttpClient      client          = httpClientClass.getClient();
                responce = await client.PostAsJsonAsync("api/User", user).ConfigureAwait(false);
            }catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }


            return(responce);
        }
Exemplo n.º 3
0
        private async Task <HttpResponseMessage> httpGet(string userName, string password)
        {
            HttpResponseMessage responce = null;

            try
            {
                HttpClientClass httpClient = new HttpClientClass();
                HttpClient      client     = httpClient.getClient();
                string          uri        = client.BaseAddress.ToString() + "api/User/" + userName + "/" + password + "/";
                Console.WriteLine("Uri: " + uri);
                responce = await client.GetAsync(uri).ConfigureAwait(false);
            }catch (Exception e)
            {
                Console.WriteLine("Error : GetUserImpl : httpGet : " + e.Message);
            }

            return(responce);
        }
Exemplo n.º 4
0
        private async Task <HttpResponseMessage> httpGet(int id)
        {
            HttpResponseMessage responce = null;

            try
            {
                HttpClientClass httpClient = new HttpClientClass();
                HttpClient      client     = httpClient.getClient();
                string          uri        = client.BaseAddress.ToString() + "api/Workout/" + id;
                responce = await client.GetAsync(uri).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error : getWorkoutImpl : httpGet : " + e.Message);
            }

            return(responce);
        }