public void shouldGetQueryFilters()
        {
            RestaurantFilters theFilters = new RestaurantFilters();

            Dictionary <String, String> filtersDictionary = theFilters.GetQueryFilters();

            filtersDictionary.Add("Added", "Successfully");
            String verifyString = "";

            foreach (String key in filtersDictionary.Keys)
            {
                verifyString += key + "=" + filtersDictionary[key];
            }

            Assert.AreEqual("Added=Successfully", verifyString);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Assembles the full query string.
        /// </summary>
        ///
        /// <precondition>
        /// none
        /// </precondition>
        ///
        /// <postcondition>
        /// none
        /// </postcondition>
        ///
        /// <returns>The complete query string</returns>
        public string AssembleQueryString()
        {
            const string queryBody = "https://api.yelp.com/v3/businesses/search?";

            const string filtersSeparator = "&";
            var          filtersQuery     = "";
            var          filterCounter    = 0;

            foreach (var key in this.theFilters.GetQueryFilters().Keys)
            {
                if (filterCounter == 0)
                {
                    filtersQuery += key + "=" + theFilters.GetQueryFilters()[key];
                }
                else
                {
                    filtersQuery += filtersSeparator + key + "=" + this.theFilters.GetQueryFilters()[key];
                }

                filterCounter++;
            }

            return(queryBody + filtersQuery);
        }