Ejemplo n.º 1
0
 public void OTTagReadTagTest2()
 {
     byte[] b = new byte[5] { 0, 1, 0, 0, 1 };
     MemoryStream ms = new MemoryStream(new byte[4] { 0, 1, 0, 0 });
     OTTag expected = new OTTag(b);
     OTTag actual = null;
     try
     {
         actual = OTTag.ReadTag(ms);
     }
     catch (Exception)
     {
         // unexpected exception
     }
     Assert.IsTrue(ArraysMatch(expected.GetBytes(), actual.GetBytes()), "Error: unexpected result from OTTag.ReadTag()");
 }
Ejemplo n.º 2
0
        public void OTTagReadTagTest1()
        {
            bool caughtExpectedException = false; // will set to true if expected exception is caught
            OTTag tag;

            byte[] b = new byte[3] { 0, 1, 0 };
            MemoryStream ms = new MemoryStream(b);
            try
            {
                tag = OTTag.ReadTag(ms);
            }
            catch (OTDataIncompleteReadException)
            {
                caughtExpectedException = true; // caught expected argument: test passes
            }
            catch (Exception)
            {
                // unexpected exception
            }
            Assert.IsTrue(caughtExpectedException, "Error: expected exception not caught");
        }