public void ReturnNull()
        {
            var reader  = new SequenceReader <byte>();
            var message = new ReadOnlySpan <byte>(Encoding.UTF8.GetBytes("MSG FOO.BAR 9 11\r\n"));
            var msg     = NatsMsg.ParseMessage(new NatsMemoryPool(), message, ref reader);

            Assert.Null(msg);
        }
        public void ReturnNatsMsg()
        {
            var reader  = new SequenceReader <byte>(new ReadOnlySequence <byte>(Encoding.UTF8.GetBytes("Hello World\r\n")));
            var message = new ReadOnlySpan <byte>(Encoding.UTF8.GetBytes("MSG FOO.BAR 9 11\r\n"));
            var msg     = NatsMsg.ParseMessage(new NatsMemoryPool(), message, ref reader);

            Assert.IsType <NatsMsg>(msg);
            ((NatsMsg)msg).Release();
        }
        public void ReturnCorrectContentWithoutRelpyTo()
        {
            var reader  = new SequenceReader <byte>(new ReadOnlySequence <byte>(Encoding.UTF8.GetBytes("Hello World\r\n")));
            var message = new ReadOnlySpan <byte>(Encoding.UTF8.GetBytes("MSG FOO.BAR 9 11\r\n"));
            var msg     = (NatsMsg)NatsMsg.ParseMessage(new NatsMemoryPool(), message, ref reader);

            Assert.Equal("FOO.BAR", msg.Subject);
            Assert.Equal("9", msg.SubscriptionId);
            Assert.Equal(11, msg.Payload.Length);
            Assert.Equal("Hello World", Encoding.UTF8.GetString(msg.Payload.Span));
            msg.Release();
        }