Helper class to build querystrings for Google Requests.
示例#1
0
        protected virtual QueryStringParametersList GetQueryStringParameters()
        {
            var _parametersList = new QueryStringParametersList();
            _parametersList.Add("sensor", Sensor.ToString().ToLower());

            return _parametersList;
        }
示例#2
0
        protected override QueryStringParametersList GetQueryStringParameters()
        {
            var _parameters = new QueryStringParametersList();

            _parameters.Add("sensor", Sensor.ToString().ToLower());

            return _parameters;
        }
示例#3
0
        /// <summary>
        /// Get the query string collection of added parameters for the request.
        /// </summary>
        /// <returns></returns>
        protected override QueryStringParametersList GetQueryStringParameters()
        {
            if (string.IsNullOrEmpty(this.ClientId))
                return base.GetQueryStringParameters();

            var parameters = new QueryStringParametersList();
            parameters.Add("sensor", Sensor.ToString().ToLower());

            return parameters;
        }
示例#4
0
        protected virtual QueryStringParametersList GetQueryStringParameters()
        {
            var _parameters = new QueryStringParametersList();

            if (!string.IsNullOrWhiteSpace(this.Key))
                _parameters.Add("key", this.Key);

            _parameters.Add("sensor", Sensor.ToString().ToLower());

            return _parameters;
        }
        public void AddTest()
        {
            const string key = "key";
            const string value = "value";

            var queryStringParametersList = new QueryStringParametersList();
            queryStringParametersList.Add(key, value);

            Assert.IsNotNull(queryStringParametersList.List);
            Assert.Contains(key, queryStringParametersList.List.Keys);
            Assert.AreEqual(value, queryStringParametersList.List[key]);
        }
        public void GetQueryStringPostfixTest()
        {
            var queryStringParametersList = new QueryStringParametersList();
            queryStringParametersList.Add("1", "1");
            queryStringParametersList.Add("2", "2");
            queryStringParametersList.Add("3", "3");

            var actual = queryStringParametersList.GetQueryStringPostfix();
            var expected = string.Join("&", queryStringParametersList.List.Select(x => Uri.EscapeDataString(x.Key) + "=" + Uri.EscapeDataString(x.Value)));

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual);
        }
        public void RemoveTest()
        {
            const string key = "key";
            const string value = "value";

            var queryStringParametersList = new QueryStringParametersList();
            queryStringParametersList.Add(key, value);
            queryStringParametersList.Remove(key);

            Assert.IsNotNull(queryStringParametersList.List);
            Assert.AreEqual(0, queryStringParametersList.List.Count);
        }
 public void ConstructorInitializesParametersCollectionTest()
 {
     var queryStringParametersList = new QueryStringParametersList();
     Assert.IsNotNull(queryStringParametersList.List);
 }