Exemple #1
0
        public async Task Users_Query()
        {
            var client = await ClientHelper.GetAuthenticatedWordPressClient();

            var queryBuilder = new UsersQueryBuilder()
            {
                Page    = 1,
                PerPage = 15,
                OrderBy = UsersOrderBy.Name,
                Order   = Order.DESC,
            };
            var queryresult = await client.Users.Query(queryBuilder);

            Assert.AreEqual(queryBuilder.BuildQueryURL(), "?page=1&per_page=15");
            Assert.IsNotNull(queryresult);
            Assert.AreNotSame(queryresult.Count(), 0);
        }
Exemple #2
0
        public async Task Users_Query()
        {
            var queryBuilder = new UsersQueryBuilder()
            {
                Page    = 1,
                PerPage = 15,
                OrderBy = UsersOrderBy.RegisteredDate,
                Order   = Order.DESC,
                Context = Context.Edit
            };

            Assert.AreEqual("?page=1&per_page=15&orderby=registered_date&order=desc&context=edit", queryBuilder.BuildQueryURL());

            var queryresult = await _clientAuth.Users.Query(queryBuilder, true);

            Assert.IsNotNull(queryresult);
            Assert.AreNotSame(queryresult.Count(), 0);
        }
Exemple #3
0
 /// <summary>
 /// Create a parametrized query and get a result
 /// </summary>
 /// <param name="queryBuilder">Query builder with specific parameters</param>
 /// <param name="useAuth">Send request with authenication header</param>
 /// <returns>List of filtered result</returns>
 public Task <IEnumerable <User> > Query(UsersQueryBuilder queryBuilder, bool useAuth = false)
 {
     return(_httpHelper.GetRequest <IEnumerable <User> >($"{_defaultPath}{_methodPath}{queryBuilder.BuildQueryURL()}", false, useAuth));
 }