public void TestIncompleteTag() { using (MemoryStream mem = new MemoryStream( new byte[] { 0x7f, 0x87, 0xef, 0xab, 0xb7, 0x6e } )) { BERReader reader = new BERReader(mem); BERReader.BERTagInfo tagInfo = new BERReader.BERTagInfo(); Assert.False(reader.ReadTagInfo(ref tagInfo)); } }
public void TestLargeTag() { using (MemoryStream mem = new MemoryStream( new byte[] { 0x7f, 0x87, 0xef, 0xab, 0xb7, 0x6e, 0x03, 0x02, 0x01, 0x01 } )) { BERReader reader = new BERReader(mem); BERReader.BERTagInfo tagInfo = new BERReader.BERTagInfo(); Assert.True(reader.ReadTagInfo(ref tagInfo)); Assert.AreEqual(1, tagInfo.ClassBits); Assert.AreEqual(true, tagInfo.IsConstructed); Assert.AreEqual(0x7deadbee, tagInfo.TagNumber); Assert.AreEqual(3, tagInfo.Length); } }