示例#1
0
        public void ProtocolErrorMessageSignedDao_ProtocolErrorMessageSigned_Should_Be_Convertible()
        {
            var byteRn = new byte[30];

            new Random().NextBytes(byteRn);

            var original = new ProtocolErrorMessage
            {
                CorrelationId = Guid.NewGuid().ToByteString(),
                Signature     = new Signature
                {
                    RawBytes       = byteRn.ToByteString(),
                    SigningContext = DevNetPeerSigningContext.Instance
                },
                PeerId = PeerIdHelper.GetPeerId("test"),
                Code   = 74
            };

            var errorMessageSignedDao = original.ToDao <ProtocolErrorMessage, ProtocolErrorMessageDao>(_mapperProvider);
            var reconverted           =
                errorMessageSignedDao.ToProtoBuff <ProtocolErrorMessageDao, ProtocolErrorMessage>(_mapperProvider);

            reconverted.Should().Be(original);
        }
示例#2
0
 private void OnError(ProtocolErrorMessage err)
 {
     Console.WriteLine("PROTOCOL ERROR: " + err.error + " ( " + err.errorDescription + ")");
 }