Пример #1
0
        public void should_create_debug_string(int limit, string prefix)
        {
            // Arrange
            var bytes  = Guid.NewGuid().ToByteArray();
            var reader = new ProtoBufferReader(bytes, 16);

            // Act
            var debugString = reader.ToDebugString(limit);

            // Assert
            var expectedString = Convert.ToBase64String(bytes.Take(limit).ToArray()) + prefix;

            debugString.ShouldEqual(expectedString);
        }
Пример #2
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);
        }