void CanConstruct()
        {
            string[] expectedString = new string[] {
                "count=30; offset=0; search=null; sort_dir=desc; sort_key=dispatch_time",
                "count=30; offset=0; search=some_unchecked_string; sort_dir=desc; sort_key=dispatch_time"
            };
            var expectedArguments = new List<Argument>[]
            {
                new List<Argument>() 
                { 
                },
                new List<Argument>() 
                { 
                    new Argument("search", "some_unchecked_string")
                }
            };

            JobCollectionArgs args;

            args = new JobCollectionArgs();
            Assert.Equal(expectedString[0], args.ToString());
            Assert.Equal(expectedArguments[0], args);
        }
        void CanSetEveryValue()
        {
            var args = new JobCollectionArgs()
            {
                Count = 100,
                Offset = 100,
                Search = "some_unchecked_string",
                SortDirection = SortDirection.Ascending,
                SortKey = "some_unchecked_string"
            };

            Assert.Equal("count=100; offset=100; search=some_unchecked_string; sort_dir=asc; sort_key=some_unchecked_string", args.ToString());

            Assert.Equal(new List<Argument>()
                { 
                    new Argument("count", "100"),
                    new Argument("offset", "100"),
                    new Argument("search", "some_unchecked_string"),
                    new Argument("sort_dir", "asc"),
                    new Argument("sort_key", "some_unchecked_string"),
                },
                args);
        }
 /// <summary>
 /// Asynchronously retrieves a collection of running search jobs.
 /// </summary>
 /// <param name="args">
 /// Specification of the collection of running search jobs to retrieve.
 /// </param>
 /// <remarks>
 /// This method uses the <a href="http://goo.gl/ja2Sev">GET 
 /// search/jobs</a> endpoint to get the <see cref="JobCollelction"/> 
 /// specified by <see cref="args"/>.
 /// </remarks>
 public async Task<JobCollection> GetJobsAsync(JobCollectionArgs args = null)
 {
     var jobs = new JobCollection(this.Context, this.Namespace, args);
     await jobs.GetAsync();
     return jobs;
 }
示例#4
0
 internal JobCollection(Context context, Namespace @namespace, JobCollectionArgs args = null)
     : base(context, @namespace, ClassResourceName, args)
 {
 }