Esempio n. 1
0
        public void Id_NotSupported()
        {
            var msg = new PublishedMessage(json);

            ExceptionAssert.Throws <NotSupportedException>(() => {
                var _ = msg.Id;
            });
        }
Esempio n. 2
0
        public void FromJson()
        {
            var msg = new PublishedMessage(json);

            Assert.AreEqual("Qmei6fBYij8gjbetgHLXmoR54iRc9hioPR7dtmBTNG3oWa", msg.Sender);
            Assert.AreEqual("14f0558fea1352e8", msg.SequenceNumber.ToHexString());
            Assert.AreEqual("68656c6c6f20776f726c64", msg.DataBytes.ToHexString());
            Assert.AreEqual("hello world", msg.DataString);
            CollectionAssert.Contains(msg.Topics.ToArray(), "net-ipfs-api-test");

            var data       = msg.DataBytes;
            var streamData = new MemoryStream();

            msg.DataStream.CopyTo(streamData);
            CollectionAssert.AreEqual(data, streamData.ToArray());
        }