public Add ( string key, string value ) : void | ||
key | string | |
value | string | |
return | void |
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 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 AddwhenKeyExistsTest() { const string key = "key"; const string value = "value"; const string valueNew = "value_new"; var queryStringParametersList = new QueryStringParametersList(); queryStringParametersList.Add(key, value); queryStringParametersList.Add(key, valueNew); Assert.IsNotNull(queryStringParametersList.List); Assert.Contains(key, queryStringParametersList.List.Keys); Assert.AreEqual(valueNew, queryStringParametersList.List[key]); Assert.AreEqual(1, queryStringParametersList.List.Count); }
protected virtual QueryStringParametersList GetQueryStringParameters() { var _parametersList = new QueryStringParametersList(); _parametersList.Add("sensor", Sensor.ToString().ToLower()); return _parametersList; }
protected override QueryStringParametersList GetQueryStringParameters() { var _parameters = new QueryStringParametersList(); _parameters.Add("sensor", Sensor.ToString().ToLower()); return _parameters; }
/// <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; }
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); }