Пример #1
0
        public void MessageReader_reads_to_end()
        {
            var expectedValue = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

            _messageBuilder.Write(expectedValue);
            var message = _messageBuilder.ToMessage();

            _messageReader.Message = message;

            Assert.Equal(expectedValue, _messageReader.ReadToEnd());
            Assert.True(_messageReader.IsAtEnd);
        }
Пример #2
0
            /// <summary>
            /// Reads the rest of the message reader's bytes to prepare for deserialization.
            /// </summary>
            public void PrepareDeserializeReader()
            {
                // Reads the rest of the message for the return value.
                var returnBytes = MessageReader.ReadToEnd();

                // Set the stream to 0 and write the content of the return value for deserialization
                Stream.SetLength(0);
                Stream.Write(returnBytes, 0, returnBytes.Length);
                Stream.Position = 0;
            }