public void SetParam() { GetRequestBuilder <int, Greeting> b = new GetRequestBuilder <int, Greeting>(baseUrl); Assert.IsFalse(b.HasParam("param1")); b.SetParam("param1", 123); Assert.IsTrue(b.HasParam("param1")); Assert.AreEqual(123, b.GetParam("param1")); b.SetParam("param1", "value1"); b.SetParam("param2", "value2"); Assert.AreEqual("value1", b.GetParam("param1")); Assert.IsTrue(b.HasParam("param2")); Assert.AreEqual("value2", b.GetParam("param2")); b.SetParams(new Dictionary <string, object>() { { "param1", "new value1" } }); Assert.IsTrue(b.HasParam("param1")); Assert.AreEqual("new value1", b.GetParam("param1")); Assert.IsTrue(b.HasParam("param2")); Assert.AreEqual("value2", b.GetParam("param2")); b.ClearParams(); Assert.IsFalse(b.HasParam("param1")); Assert.IsFalse(b.HasParam("param2")); }
public void AddParam() { GetRequestBuilder <int, Greeting> b = new GetRequestBuilder <int, Greeting>(baseUrl); b.AddParam("param2", "value2"); Assert.IsFalse(b.HasParam("param1")); Assert.IsTrue(b.HasParam("param2")); List <object> paramList = (List <object>)b.GetParam("param2"); Assert.AreEqual("value2", paramList[0], "value2"); b.AddParam("param2", 123); paramList = (List <object>)b.GetParam("param2"); Assert.IsTrue(paramList.Count == 2); Assert.AreEqual("value2", paramList[0]); Assert.AreEqual(123, paramList[1]); }