public void EmptyValueParametersUnittest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); string testParamStr1 = ";emptykey;Server=hippo;FTag=12345"; SIPParameters testParam1 = new SIPParameters(testParamStr1, ';'); Console.WriteLine("Parameter 1:" + testParam1.ToString()); Assert.IsTrue(testParam1.Has("emptykey"), "The empty parameter \"emptykey\" was not correctly extracted from the paramter string."); Assert.IsTrue(Regex.Match(testParam1.ToString(), "emptykey").Success, "The emptykey name was not in the output parameter string."); }
public void GetHashCodeDiffOrderEqualityUnittest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); string testParamStr1 = ";lr;server=hippo;ftag=12345"; SIPParameters testParam1 = new SIPParameters(testParamStr1, ';'); string testParamStr2 = "ftag=12345;lr;server=hippo;"; SIPParameters testParam2 = new SIPParameters(testParamStr2, ';'); Assert.IsTrue(testParam1.GetHashCode() == testParam2.GetHashCode(), "The parameters had different hashcode values."); }
public void QuotedStringParamExtractTest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); string methodsParam = ";methods=\"INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER\""; SIPParameters serverParam = new SIPParameters(methodsParam, ';'); string methodsParamValue = serverParam.Get("methods"); Console.WriteLine("Parameter string=" + serverParam.ToString() + "."); Console.WriteLine("The methods parameter is=" + methodsParamValue + "."); Assert.IsTrue(methodsParamValue == "\"INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER\"", "The method parameter was not correctly extracted."); }
public void RouteParamExtractTest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); string routeParam = ";lr;server=hippo"; SIPParameters serverParam = new SIPParameters(routeParam, ';'); string serverParamValue = serverParam.Get("server"); Console.WriteLine("Parameter string=" + serverParam.ToString() + "."); Console.WriteLine("The server parameter is=" + serverParamValue + "."); Assert.IsTrue(serverParamValue == "hippo", "The server parameter was not correctly extracted."); }
public void GetHashCodeDiffValueCaseEqualityUnittest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); string testParamStr1 = ";LR;Server=hippo;FTag=12345"; SIPParameters testParam1 = new SIPParameters(testParamStr1, ';'); Console.WriteLine("Parameter 1:" + testParam1.ToString()); string testParamStr2 = "ftag=12345;lr;server=HiPPo;"; SIPParameters testParam2 = new SIPParameters(testParamStr2, ';'); Console.WriteLine("Parameter 2:" + testParam2.ToString()); Assert.IsTrue(testParam1.GetHashCode() != testParam2.GetHashCode(), "The parameters had different hashcode values."); }
private void ParseParamsAndHeaders(string paramsAndHeaders) { if (paramsAndHeaders != null && paramsAndHeaders.Trim().Length > 0) { int headerDelimPosn = paramsAndHeaders.IndexOf(HEADER_START_DELIMITER); if (headerDelimPosn == -1) { Parameters = new SIPParameters(paramsAndHeaders, PARAM_TAG_DELIMITER); } else { Parameters = new SIPParameters(paramsAndHeaders.Substring(0, headerDelimPosn), PARAM_TAG_DELIMITER); Headers = new SIPParameters(paramsAndHeaders.Substring(headerDelimPosn + 1), HEADER_TAG_DELIMITER); } } }
public SIPParameters CopyOf() { SIPParameters copy = new SIPParameters(ToString(), TagDelimiter); return(copy); }