void CanSetEveryValue()
        {
            var args = new SavedSearchCollectionArgs()
            {
                Count = 100,
                EarliestTime = "some_unchecked_string",
                LatestTime = "some_unchecked_string",
                ListDefaultActions = true,
                Offset = 100,
                Search = "some_unchecked_string",
                SortDirection = SortDirection.Descending,
                SortKey = "some_unchecked_string",
                SortMode = SortMode.Alphabetic
            };

            Assert.Equal("count=100; earliest_time=some_unchecked_string; latest_time=some_unchecked_string; listDefaultActionArgs=t; offset=100; search=some_unchecked_string; sort_dir=desc; sort_key=some_unchecked_string; sort_mode=alpha", args.ToString());

            var list = new List<Argument>()
            { 
                new Argument("count", "100"),
                new Argument("earliest_time", "some_unchecked_string"),
                new Argument("latest_time", "some_unchecked_string"),
                new Argument("listDefaultActionArgs", "t"),
                new Argument("offset", "100"),
                new Argument("search", "some_unchecked_string"),
                new Argument("sort_dir", "desc"),
                new Argument("sort_key", "some_unchecked_string"),
                new Argument("sort_mode", "alpha")
            };

            Assert.Equal(list, args);
        }
        void CanConstruct()
        {
            string[] expectedString = new string[] {
                "count=30; earliest_time=null; latest_time=null; listDefaultActionArgs=f; offset=0; search=null; sort_dir=asc; sort_key=name; sort_mode=auto",
                "count=30; earliest_time=null; latest_time=null; listDefaultActionArgs=f; offset=0; search=some_unchecked_string; sort_dir=asc; sort_key=name; sort_mode=auto",
            };
            var expectedArguments = new List<Argument>[]
            {
                new List<Argument>() 
                { 
                },
                new List<Argument>() 
                { 
                    new Argument("search", "some_unchecked_string")
                }
            };

            SavedSearchCollectionArgs args;

            args = new SavedSearchCollectionArgs();
            Assert.Equal(expectedString[0], args.ToString());
            Assert.Equal(expectedArguments[0], args);
        }
Пример #3
0
 /// <summary>
 /// Asynchronously retrieves a collection of saved searches.
 /// </summary>
 /// <param name="args">
 /// Arguments identifying the collection of <see cref="SavedSearch"/>
 /// entries to retrieve.
 /// </param>
 /// <returns>
 /// A new <see cref="SavedSearchCollection"/> containing the <see cref=
 /// "SavedSearch"/> entries identified by <see cref="args"/>.
 /// </returns>
 /// <remarks>
 /// This method uses the <a href="http://goo.gl/bKrRK0">GET 
 /// saved/searches</a> endpoint to retrieve a new <see cref=
 /// "SavedSearchCollection"/> containing the <see cref="SavedSearch"/> 
 /// entries identified by <see cref="args"/>.
 /// </remarks>
 public async Task<SavedSearchCollection> GetSavedSearchesAsync(SavedSearchCollectionArgs args = null)
 {
     var resource = new SavedSearchCollection(this.Context, this.Namespace, args);
     await resource.GetAsync();
     return resource;
 }
 internal SavedSearchCollection(Context context, Namespace @namespace, SavedSearchCollectionArgs args = null)
     : base(context, @namespace, ClassResourceName, args)
 {
 }