Пример #1
0
        public void TryAppend_should_correctly_assemble_message_from_multiple_record_groups()
        {
            builder.TryAppend("key1", CreateGroupBufferSlice("message1"));
            builder.TryAppend("key2", CreateGroupBufferSlice("message22"));
            builder.TryAppend("key3", CreateGroupBufferSlice("message333"));

            builder.Message.Count.Should().Be(81);

            var reader = new BinaryBufferReader(buffer, 0);

            reader.ReadInt16().Should().Be(1);             // version
            reader.ReadInt32().Should().Be(3);             // groups count

            reader.ReadString().Should().Be("key1");       // routing key
            reader.ReadInt32().Should().Be(1);             // payload count
            reader.ReadString().Should().Be("message1");   // payload message

            reader.ReadString().Should().Be("key2");       // routing key
            reader.ReadInt32().Should().Be(1);             // payload count
            reader.ReadString().Should().Be("message22");  // payload message

            reader.ReadString().Should().Be("key3");       // routing key
            reader.ReadInt32().Should().Be(1);             // payload count
            reader.ReadString().Should().Be("message333"); // payload message
        }
        public void ReadInt16(Int16 input)
        {
            Reset();
            _writer.Write(input);

            var val = _bufferReader.ReadInt16();

            Assert.Equal(input, val);
        }