Exemple #1
0
        public void Can_do_roundtrip()
        {
            LogEntry        logEntry     = new LogEntry(TestItem.AddressA, new byte[] { 1, 2, 3 }, new[] { TestItem.KeccakA, TestItem.KeccakB });
            LogEntryDecoder decoder      = new LogEntryDecoder();
            Rlp             rlp          = decoder.Encode(logEntry);
            LogEntry        deserialized = decoder.Decode(rlp.Bytes.AsRlpStream());

            Assert.AreEqual(logEntry.Data, deserialized.Data, "data");
            Assert.AreEqual(logEntry.LoggersAddress, deserialized.LoggersAddress, "address");
            Assert.AreEqual(logEntry.Topics, deserialized.Topics, "topics");
        }
        public void Can_do_roundtrip_rlp_stream()
        {
            LogEntry        logEntry = new(TestItem.AddressA, new byte[] { 1, 2, 3 }, new[] { TestItem.KeccakA, TestItem.KeccakB });
            LogEntryDecoder decoder  = LogEntryDecoder.Instance;

            Rlp      encoded      = decoder.Encode(logEntry);
            LogEntry deserialized = decoder.Decode(new RlpStream(encoded.Bytes));

            Assert.AreEqual(logEntry.Data, deserialized.Data, "data");
            Assert.AreEqual(logEntry.LoggersAddress, deserialized.LoggersAddress, "address");
            Assert.AreEqual(logEntry.Topics, deserialized.Topics, "topics");
        }