Esempio n. 1
0
        private bool TryDeserializeTransportMessage(ProtoBufferReader bufferReader, out TransportMessage transportMessage)
        {
            if (bufferReader.TryReadTransportMessage(out transportMessage))
            {
                return(true);
            }

            _logger.Debug($"Unable to read transport message, Length: {bufferReader.Length}, Bytes: {bufferReader.ToDebugString(50)}");

            return(false);
        }
        public void should_not_throw_on_invalid_message(string content)
        {
            var buffer = Encoding.ASCII.GetBytes(content);

            var bufferReader = new ProtoBufferReader(buffer, buffer.Length);
            TransportMessage transportMessage = null;
            bool?            result           = null;

            Assert.DoesNotThrow(() => result = bufferReader.TryReadTransportMessage(out transportMessage));

            result.ShouldNotBeNull();
            result.ShouldEqual(false);
            transportMessage.ShouldNotBeNull();
            transportMessage.Id.ShouldEqual(default(MessageId));
            transportMessage.Environment.ShouldBeNull();
        }