public void HelperFunctions() { string s = "this is a teststring so that we can find something from the beginning"; byte[] sBinary = Encoding.ASCII.GetBytes(s); MemoryStream stream = new MemoryStream(sBinary); stream.Position = 0L; bool result = OSDParser.FindString(stream, "this"); Assert.AreEqual(true, result); Assert.AreEqual(4L, stream.Position); stream.Position = 10L; result = OSDParser.FindString(stream, "teststring"); Assert.AreEqual(true, result); Assert.AreEqual(20L, stream.Position); stream.Position = 25L; result = OSDParser.FindString(stream, "notfound"); Assert.AreEqual(false, result); Assert.AreEqual(25L, stream.Position); stream.Position = 60L; result = OSDParser.FindString(stream, "beginningAndMore"); Assert.AreEqual(false, result); Assert.AreEqual(60L, stream.Position); byte[] sFrontWhiteSpace = Encoding.ASCII.GetBytes(" \t\t\n\rtest"); MemoryStream streamTwo = new MemoryStream(sFrontWhiteSpace); OSDParser.SkipWhiteSpace(streamTwo); Assert.AreEqual(7L, streamTwo.Position); byte[] sMiddleWhiteSpace = Encoding.ASCII.GetBytes("test \t\t\n\rtest"); MemoryStream streamThree = new MemoryStream(sMiddleWhiteSpace); streamThree.Position = 4L; OSDParser.SkipWhiteSpace(streamThree); Assert.AreEqual(9L, streamThree.Position); byte[] sNoWhiteSpace = Encoding.ASCII.GetBytes("testtesttest"); MemoryStream streamFour = new MemoryStream(sNoWhiteSpace); OSDParser.SkipWhiteSpace(streamFour); Assert.AreEqual(0L, streamFour.Position); }