public void TestParserReadBeyondEof() { using (Parser parser = new Parser()) { parser.Load("Tests", _testdata); parser.Read(6); } }
public void TestParserReadFull() { using (Parser parser = new Parser()) { parser.Load("Tests", _testdata); byte[] testassert = parser.Read(5); CollectionAssert.AreEqual(_testdata, testassert, string.Format("Read Function did not return correct result: Expected: {0}, Actual: {1}", _testdata, testassert)); } }
public void TestParserReadPartial() { using (Parser parser = new Parser()) { parser.Load("Tests", _testdata); byte[] testassert1 = parser.Read(4); byte[] firstdata = new byte[4]; Array.Copy(_testdata, 0, firstdata, 0, 4); CollectionAssert.AreEqual(firstdata, testassert1, string.Format("Read Function did not return correct result: Expected: {0}, Actual: {1}", firstdata, testassert1)); byte[] testassert2 = parser.Read(0); byte[] empty = {}; CollectionAssert.AreEqual(empty, testassert2, string.Format("Read Function did not return correct result: Expected: {0}, Actual: {1}", empty, testassert2)); byte[] testassert3 = parser.Read(1); byte[] lastdata = new byte[1]; Array.Copy(_testdata, 4, lastdata, 0, 1); CollectionAssert.AreEqual(lastdata, testassert3, string.Format("Read Function did not return correct result: Expected: {0}, Actual: {1}", lastdata, testassert3)); } }