public void ReadTagFails5Bytes() { var ms = new MemoryStream(new byte[] { 0x1F, 0x80, 0x80, 0x80, 0x00 }); Assert.ThrowsException <TlvException>(() => { TlvEncoding.ReadNextTag(ms, false); }); }
public void ReadTagSuccessNonEmv(byte[] input, uint?expectedTag, int expectedLength) { var ms = new MemoryStream(input); var t = TlvEncoding.ReadNextTag(ms, false); Assert.AreEqual(expectedTag, t); Assert.AreEqual(expectedLength, ms.Position); }
public void ReadTagFailsUnexpectedEnd(byte[] input) { var ms = new MemoryStream(input); Assert.ThrowsException <TlvException>(() => { TlvEncoding.ReadNextTag(ms, false); }); // last octet is indicating a subsequent octet, but no more data }