public void WhenHasMultipleSameNames_ThenReturnWithoutDuplicates() { var names = new List <string> { "name1", "name2", "name1", "name3" }; var result = UriQueryConverter.ToString(names); Assert.That(result, Is.EqualTo("?name1&name2&name3")); }
public void WhenParamNamesContainEncodableChar_ThenEncodeNames() { var names = new List <string> { "name1", "name 2", "name/3" }; var result = UriQueryConverter.ToString(names); Assert.That(result, Is.EqualTo("?name1&name+2&name%2f3")); }
public void WhenHasNullOrEmptyNames_ThenSkipName(string name) { var names = new List <string> { name }; var result = UriQueryConverter.ToString(names); Assert.That(result, Is.Empty); }
public void WhenHasTwoNames_ThenReturnString() { var names = new List <string> { "name1", "name2" }; var result = UriQueryConverter.ToString(names); Assert.That(result, Is.EqualTo("?name1&name2")); }
public void WhenHasOnePairWithValue_ThenReturnString() { var nameValues = new NameValueCollection { { "key", "value" } }; var result = UriQueryConverter.ToString(nameValues); Assert.That(result, Is.EqualTo("?key=value")); }
public void WhenPairNameIsNullOrEmpty_ThenSkipPair(string name) { var nameValues = new NameValueCollection { { name, "value" } }; var result = UriQueryConverter.ToString(nameValues); Assert.That(result, Is.Empty); }
public void WhenHasOnePair_ThenReturnString() { var dict = new Dictionary <string, string> { { "key1", "value1" } }; var result = UriQueryConverter.ToString(dict); Assert.That(result, Is.EqualTo("?key1=value1")); }
public void WhenPairValueIsEmpty_ThenReturnString() { var dict = new Dictionary <string, string> { { "key1", string.Empty } }; var result = UriQueryConverter.ToString(dict); Assert.That(result, Is.EqualTo("?key1=")); }
public void WhenPairNameIsEmpty_ThenSkipPair() { var dict = new Dictionary <string, string> { { string.Empty, "value" } }; var result = UriQueryConverter.ToString(dict); Assert.That(result, Is.Empty); }
public void WhenHasTwoPairs_ThenReturnString() { var nameValues = new NameValueCollection { { "key1", "value1" }, { "key2", "value2" } }; var result = UriQueryConverter.ToString(nameValues); Assert.That(result, Is.EqualTo("?key1=value1&key2=value2")); }
public void WhenParamNameAndValueContainsEncodableChars_ThenReturnString() { var dict = new Dictionary <string, string> { { "key1", "value1" }, { "key 2", "value 2" }, { "key/3", "value/3" } }; var result = UriQueryConverter.ToString(dict); Assert.That(result, Is.EqualTo("?key1=value1&key+2=value+2&key%2f3=value%2f3")); }
public void WhenParamNameAndValueContainsEncodableChars_ThenEncodeNamesAndValues() { var nameValues = new NameValueCollection { { "key1", "value1" }, { "key 2", "value 2" }, { "key/3", "value/3" } }; var result = UriQueryConverter.ToString(nameValues); Assert.That(result, Is.EqualTo("?key1=value1&key+2=value+2&key%2f3=value%2f3")); }
public void WhenIsEmpty_ThenReturnEmpty() { var result = UriQueryConverter.ToString(new Dictionary <string, string>()); Assert.That(result, Is.Empty); }
public void WhenIsEmpty_ThenReturnEmpty() { var result = UriQueryConverter.ToString(new NameValueCollection()); Assert.That(result, Is.Empty); }
public void WhenIsNull_ThenReturnEmpty() { var result = UriQueryConverter.ToString(null as IEnumerable <string>); Assert.That(result, Is.Empty); }
public void WhenIsEmpty_ThenReturnEmpty() { var result = UriQueryConverter.ToString(Enumerable.Empty <string>()); Assert.That(result, Is.Empty); }
public void WhenIsNull_ThenReturnEmpty() { var result = UriQueryConverter.ToString(null as IDictionary <string, string>); Assert.That(result, Is.Empty); }