private async Task <HttpStatusCode> ReadUserById(string id)
        {
            var url      = $"users/{id}";
            var client   = _factory.CreateClient();
            var response = await client.GetAsync(url);

            var responseHttpStatus = response.StatusCode;

            return(responseHttpStatus);
        }
Example #2
0
        private async Task <HttpStatusCode> GetUploadUsersResultCode(string fileName)
        {
            var client = _factory.CreateClient();

            var path = Path.Combine("CsvFiles", fileName);

            using (var csvFile = File.OpenRead(path))
                using (var fileContent = new StreamContent(csvFile))
                    using (var formData = new MultipartFormDataContent())
                    {
                        formData.Add(fileContent, "file", "ValidWithOneRecord.csv");
                        var response = await client.PostAsync("users/upload", formData);

                        var responseHttpStatus = response.StatusCode;
                        return(responseHttpStatus);
                    }
        }
Example #3
0
        private async Task <HttpResponseMessage> GetUserDashboardResultCode(
            decimal minSalary,
            decimal maxSalary,
            long offset,
            long limit,
            string sort)
        {
            var url      = $"users?minSalary={minSalary}&maxSalary={maxSalary}&offset={offset}&limit={limit}&sort={sort}";
            var client   = _factory.CreateClient();
            var response = await client.GetAsync(url);

            return(response);
        }