Example #1
0
        private async Task<string> GetCostCentreApplicationId(string costCentreId, HttpClient client)
        {
            var httpParams = new HttpParams();
            httpParams.Add("costCentreId", costCentreId);
            httpParams.Add("applicationDescription", "Android_Application");

            var response = await client.GetAsync(COST_CENTRE_APPLICATION_ID_ENDPOINT + httpParams);
            var content = response.Content;

            var text = await content.ReadAsStringAsync();

            return JsonConvert.DeserializeObject<CostCentreApplicationIdResult>(text).CostCentreApplicationId;
        }
Example #2
0
        private async Task<string> GetCostCentreId(string username, string password, HttpClient client)
        {
            var httpParams = new HttpParams();
            httpParams.Add("Username", username);
            httpParams.Add("Password", password);
            httpParams.Add("usertype", "DistributorSalesman");

            var response = await client.GetAsync(LOGIN_ENDPOINT + httpParams);
            var content = response.Content;

            var text = await content.ReadAsStringAsync();

            return JsonConvert.DeserializeObject<CostCentreIdResult>(text).CostCentreId;
        }
Example #3
0
        public void AddFakePostResponse(string path, HttpParams httpParams, string responseText, string expectedBody)
        {
            var fullPath = Path.Combine("/", path + httpParams);

            responses.Add(new FakePostResponse(fullPath, responseText, expectedBody));
        }
Example #4
0
        public void AddFakeGetResponse(string path, HttpParams httpParams, string responseText )
        {
            var fullPath = Path.Combine("/", path + httpParams);

            responses.Add(new FakeGetResponse(fullPath, responseText));
        }