public void ParseQueryString_Null_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var nvc = simpleQueryString.ParseQueryString(null); nvc.Count.ShouldEqual(0); }
public void CreateQueryString_Null_NotAutoAppend_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var queryString = simpleQueryString.CreateQueryString(null, false); queryString.ShouldEqual(string.Empty); }
public void CreateQueryStringFromObject_MultiValues_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var myObj = new MyObjectWithMultiValues(); simpleQueryString.CreateQueryStringFromObject(myObj, false).ShouldEqual("A=1,2&B=2&B=3&C=4&C=5"); simpleQueryString.CreateQueryStringFromObject(myObj, false, new [] { "a", "B" }).ShouldEqual("A=1,2&B=2&B=3"); }
public void ParseQueryStringToDic_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var dic = simpleQueryString.ParseQueryStringToDic("a=1&b=2&b=3"); dic.Count.ShouldEqual(2); dic["A"].ShouldEqual("1"); dic["B"].ShouldEqual("2,3"); }
public void ParseQueryString_EmptyValue_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var nvc = simpleQueryString.ParseQueryString("a=1&b="); nvc.Count.ShouldEqual(2); nvc["A"].ShouldEqual("1"); nvc["B"].ShouldEqual(string.Empty); }
public void CreateQueryString_EmptyValue_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var nvc = new NameValueCollection(); nvc.Add("a", "1"); nvc.Add("b", ""); var queryString = simpleQueryString.CreateQueryString(nvc, false); queryString.ShouldEqual("a=1&b="); }
public void CreateQueryStringFromObject_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var myObj = new MyObject(); myObj.A = "1"; myObj.B = 2; var queryString = simpleQueryString.CreateQueryStringFromObject(myObj, false); queryString.ShouldEqual("A=1&B=2"); }
public void CreateQueryStringFromDic_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var dic = new Dictionary <string, string>(); dic.Add("a", "1"); dic.Add("b", "2"); var queryString = simpleQueryString.CreateQueryStringFromDic(dic, false); queryString.ShouldEqual("a=1&b=2"); }
public void ParseQueryString_RepeatKey_Should_Ok() { var simpleQueryString = new SimpleQueryString(); var nvc = simpleQueryString.ParseQueryString("a=1&b=2&b=3"); nvc.Count.ShouldEqual(2); nvc["A"].ShouldEqual("1"); nvc["B"].ShouldEqual("2,3"); var values = nvc.GetValues("b"); values.Length.ShouldEqual(2); values[0].ShouldEqual("2"); values[1].ShouldEqual("3"); }