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); }
public void ParseTest() { var envelope = NetworkEnvelope.Parse(Cipher.ToBytes(noPayloadHex)); Assert.Equal("verack", envelope.Command); Assert.Empty(envelope.Payload); Assert.False(envelope.Testnet); }
public void ToBytesTest() { var envelope = NetworkEnvelope.Parse(Cipher.ToBytes(noPayloadHex)); Assert.Equal(noPayloadHex, envelope.ToBytes().ToHex()); }
public void ParseBadFormatTest(string hex) { Assert.Throws <FormatException>(() => NetworkEnvelope.Parse(Cipher.ToBytes(hex))); }