示例#1
0
 public void ChangeOldValueInUrlOnNewValueFromParameterWithSameKey()
 {
     Assert.AreEqual("www.example.com?key=newValue", MyStaticClass.AddOrChangeUrlParameter("www.example.com?key=oldValue", "key=newValue"));
     Assert.AreEqual("www.example.com?key=newValue&key2=oldValue2", MyStaticClass.AddOrChangeUrlParameter("www.example.com?key=oldValue&key2=oldValue2", "key=newValue"));
     Assert.AreEqual("www.example.com?key=oldValue&key2=newValue2", MyStaticClass.AddOrChangeUrlParameter("www.example.com?key=oldValue&key2=oldValue2", "key2=newValue2"));
     Assert.AreEqual("www.example.com?key=newValue&key2=newValue2", MyStaticClass.AddOrChangeUrlParameter("www.example.com?key=oldValue&key2=oldValue2", "key=newValue&key2=newValue2"));
 }
示例#2
0
 public void AddNewParameterToUrlWithoutParameter()
 {
     Assert.AreEqual("www.example.com?key=value", MyStaticClass.AddOrChangeUrlParameter("www.example.com", "key=value"));
 }
示例#3
0
 public void NullArguments()
 {
     Assert.Throws <System.ArgumentNullException>(() => MyStaticClass.AddOrChangeUrlParameter("", null));
     Assert.Throws <System.ArgumentNullException>(() => MyStaticClass.AddOrChangeUrlParameter(null, ""));
     Assert.Throws <System.ArgumentNullException>(() => MyStaticClass.AddOrChangeUrlParameter(null, null));
 }
示例#4
0
 public void AddEmptyParameter()
 {
     Assert.AreEqual("www.example.com", MyStaticClass.AddOrChangeUrlParameter("www.example.com?", ""));
 }