示例#1
0
            public void GetStringIndexNotFoundUnitTest()
            {
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name);

                string sipMsg =
                    "REGISTER sip:Blue Face SIP/2.0\r\n" +
                    "Via: SIP/2.0/UDP 127.0.0.1:1720;branch=z9hG4bKlgnUQcaywCOaPcXR\r\n" +
                    "Max-Forwards: 70\r\n" +
                    "User-Agent: PA168S\r\n" +
                    "From: \"user\" <sip:user@Blue Face>;tag=81swjAV7dHG1yjd5\r\n" +
                    "To: \"user\" <sip:user@Blue Face>\r\n" +
                    "Call-ID: [email protected]\r\n" +
                    "CSeq: 15754 REGISTER\r\n" +
                    "Contact: <sip:[email protected]:1720>\r\n" +
                    "Expires: 30\r\n" +
                    "Content-Length: 0\r\n";

                byte[] sample = Encoding.ASCII.GetBytes(sipMsg);

                int endOfMsgIndex = ByteBufferInfo.GetStringPosition(sample, 0, Int32.MaxValue, "\r\n\r\n", null);

                Assert.IsTrue(endOfMsgIndex == -1, "The string position was not correctly found in the buffer.");
            }