public void NoPayload()
    {
        var prefixWriter = new PrefixingBufferWriter <byte>(this.sequence, Prefix.Length, 50);

        Assert.Equal(0, this.sequence.Length);
        Prefix.CopyTo(prefixWriter.Prefix);
        prefixWriter.Commit();
        Assert.Equal(Prefix.Length, this.sequence.Length);
        Assert.Equal(Prefix.ToArray(), this.sequence.AsReadOnlySequence.ToArray());
    }
    private void PayloadCompleteHelper(PrefixingBufferWriter <byte> prefixWriter)
    {
        // There mustn't be any calls to Advance on the underlying buffer yet, or else we've lost the opportunity to write the prefix.
        Assert.Equal(0, this.sequence.Length);
        var length = prefixWriter.Length;

        // Go ahead and commit everything, with our prefix.
        Prefix.CopyTo(prefixWriter.Prefix);
        prefixWriter.Commit();

        Assert.Equal(length + Prefix.Length, this.sequence.Length);

        // Verify that the prefix immediately precedes the payload.
        Assert.Equal(Prefix.ToArray().Concat(Payload.ToArray()), this.sequence.AsReadOnlySequence.ToArray());
    }