示例#1
0
 public void TestParserReadBeyondEof()
 {
     using (Parser parser = new Parser())
     {
         parser.Load("Tests", _testdata);
         parser.Read(6);
     }
 }
示例#2
0
 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));
     }
 }
示例#3
0
 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));
     }
 }