Esempio n. 1
0
        public async Task Categories_Query()
        {
            var queryBuilder = new CategoriesQueryBuilder()
            {
                Page    = 1,
                PerPage = 15,
                OrderBy = TermsOrderBy.Id,
                Order   = Order.DESC,
            };
            var queryresult = await _clientAuth.Categories.Query(queryBuilder);

            Assert.AreEqual("?page=1&per_page=15&orderby=id", queryBuilder.BuildQueryURL());
            Assert.IsNotNull(queryresult);
            Assert.AreNotSame(queryresult.Count(), 0);
        }
Esempio n. 2
0
        public async Task Categories_Query()
        {
            var client = await ClientHelper.GetAuthenticatedWordPressClient();

            var queryBuilder = new CategoriesQueryBuilder()
            {
                Page    = 1,
                PerPage = 15,
                OrderBy = TermsOrderBy.Id,
                Order   = Order.DESC,
            };
            var queryresult = await client.Categories.Query(queryBuilder);

            Assert.AreEqual(queryBuilder.BuildQueryURL(), "?page=1&per_page=15&orderby=id&order=desc");
            Assert.IsNotNull(queryresult);
            Assert.AreNotSame(queryresult.Count(), 0);
        }
Esempio n. 3
0
 /// <summary>
 /// Create a parametrized query and get a result
 /// </summary>
 /// <param name="queryBuilder">Categories query builder with specific parameters</param>
 /// <param name="useAuth">Send request with authenication header</param>
 /// <returns>List of filtered categories</returns>
 public async Task <IEnumerable <Category> > Query(CategoriesQueryBuilder queryBuilder, bool useAuth = false)
 {
     return(await _httpHelper.GetRequest <IEnumerable <Category> >($"{_defaultPath}{_methodPath}{queryBuilder.BuildQueryURL()}", false, useAuth).ConfigureAwait(false));
 }
Esempio n. 4
0
 public async Task <IEnumerable <Category> > Query(CategoriesQueryBuilder QueryBuilder)
 {
     return(await HttpHelper.GetRequests <IEnumerable <Category> >(_methodPath + "/" + QueryBuilder.BuildQueryURL()));
 }