/// <summary>
        /// Composes a relative URI from given ClientRequest instance
        /// </summary>
        /// <param name="request">Instance of ClientRequest object</param>
        /// <returns></returns>
        protected virtual string ComposeUri(ClientRequest request)
        {
            request.HydratePaginationQuery();
            request.HydrateSortingQuery();
            request.HydrateFilteringQuery();

            string queryString = null;

            if (request.Query != null && request.Query.Count > 0)
            {
                List <string> queryStringList = new List <string>();
                foreach (KeyValuePair <string, string> query in request.Query)
                {
                    if (query.Value != null)
                    {
                        queryStringList.Add($"{query.Key}={query.Value}");
                    }
                    else
                    {
                        queryStringList.Add(query.Key);
                    }
                }

                queryString = "?" + string.Join("&", queryStringList);
            }

            return(request.Resource.TrimStart('/') + queryString);
        }
        public void HydratePaginationQuery_NullParameters_MissingPaginationQueryExpected()
        {
            var request = new ClientRequest()
            {
                Parameters = null
            };

            request.HydratePaginationQuery();

            Assert.AreEqual(0, request.Query.Count);
        }
        public void HydratePaginationQuery_WithPerPage_ExpectedQuery()
        {
            ClientRequestParameters parameters = new ClientRequestParameters()
            {
                Pagination = new ClientRequestPagination()
                {
                    PerPage = 3
                }
            };

            var request = new ClientRequest()
            {
                Parameters = parameters
            };

            request.HydratePaginationQuery();

            Assert.IsTrue(request.Query.ContainsKey("per_page"));
            Assert.AreEqual("3", request.Query["per_page"]);
        }