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;
        }
예제 #5
0
        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]);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
 public void ConstructorInitializesParametersCollectionTest()
 {
     var queryStringParametersList = new QueryStringParametersList();
     Assert.IsNotNull(queryStringParametersList.List);
 }