Exemple #1
0
        public void ToBytesWithPayloadTest()
        {
            var envelope  = new NetworkEnvelope("ping", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
            var envelope2 = NetworkEnvelope.Parse(envelope.ToBytes());

            Assert.Equal(envelope.Command, envelope2.Command);
            Assert.Equal(envelope.Payload, envelope2.Payload);
        }
Exemple #2
0
        public void ParseTest()
        {
            var envelope = NetworkEnvelope.Parse(Cipher.ToBytes(noPayloadHex));

            Assert.Equal("verack", envelope.Command);
            Assert.Empty(envelope.Payload);
            Assert.False(envelope.Testnet);
        }
Exemple #3
0
        public void ToBytesTest()
        {
            var envelope = NetworkEnvelope.Parse(Cipher.ToBytes(noPayloadHex));

            Assert.Equal(noPayloadHex, envelope.ToBytes().ToHex());
        }
Exemple #4
0
 public void ParseBadFormatTest(string hex)
 {
     Assert.Throws <FormatException>(() => NetworkEnvelope.Parse(Cipher.ToBytes(hex)));
 }