public void AppendQueryParam() { var url = new UrlBuilder("http://www.shoutem.com/app"); url.AppendQueryParam("nid", 123); var param = url.GetQueryParam("nid"); Assert.AreEqual("123", param.ToString()); }
public void SetQueryParamToEmtpy() { var url = new UrlBuilder("http://www.shoutem.com/app"); url.SetQueryParam("nid", string.Empty); var param = url.GetQueryParam("nid"); Assert.AreEqual(string.Empty, param.ToString()); }
public void SetQueryParamToNull() { var url = new UrlBuilder("http://www.shoutem.com/app"); url.SetQueryParam("nid", null); var param = url.GetQueryParam("nid"); Assert.AreEqual(null, param); }
public void SetExistingQueryParam() { var url = new UrlBuilder("http://www.shoutem.com/app?nid=123"); url.SetQueryParam("nid", 321); var param = url.GetQueryParam("nid"); Assert.AreEqual("321", param.ToString()); }
public void AppendExistingQueryParam() { var url = new UrlBuilder("http://www.shoutem.com/app"); url.SetQueryParam("role", "moderator"); url.AppendQueryParam("role", "admin"); var paramList = url.GetQueryParam("role") as IList<object>; var param1 = paramList[0]; var param2 = paramList[1]; Assert.AreEqual("moderator", param1.ToString()); Assert.AreEqual("admin", param2.ToString()); }
public void SetQueryParams() { var url = new UrlBuilder("http://www.shoutem.com/app"); var dictParams = new Dictionary<string, object> {{"nid", 123}, {"role", "admin"}}; url.SetQueryParams(dictParams); var param1 = url.GetQueryParam("nid"); var param2 = url.GetQueryParam("role"); Assert.AreEqual("123", param1.ToString()); Assert.AreEqual("admin", param2.ToString()); }
public void GetQueryParam() { var url = new UrlBuilder("http://www.shoutem.com/app?nid=123&role=admin"); var param = url.GetQueryParam("role"); Assert.AreEqual("admin", param.ToString()); }
public void SetMultipleQueryParam() { var url = new UrlBuilder("http://www.shoutem.com/app?role=moderator&role=admin"); var paramList = url.GetQueryParam("role") as IList<object>; var param1 = paramList[0]; var param2 = paramList[1]; Assert.AreEqual("moderator", param1.ToString()); Assert.AreEqual("admin", param2.ToString()); }