public unsafe void TestProfilerStreamDoesNotThrowIfGoodSize()
        {
            var stream = new ProfilerProtocolStream(123);

            stream.EmitBlockBegin(ProfilerMessageType.BeginSample, 4);
            stream.buffer->WriteData <uint>(10);
            Assert.DoesNotThrow(() => stream.EmitBlockEnd());
            stream.buffer->m_BufferList->Free();
        }
        public unsafe void TestProfilerStreamThrowsIfBadSize()
        {
            var stream = new ProfilerProtocolStream(123);

            stream.EmitBlockBegin(ProfilerMessageType.BeginSample, 4);
            stream.buffer->WriteData <uint>(10);
            stream.buffer->WriteData <uint>(11);
            Assert.Throws <InvalidOperationException>(() => stream.EmitBlockEnd());
            stream.buffer->m_BufferList->Free();
        }
        public unsafe void TestProfilerStreamBlockSizeIsAutoAligned()
        {
            var stream = new ProfilerProtocolStream(123);

            stream.EmitBlockBegin(ProfilerMessageType.BeginSample, 3);
            stream.buffer->WriteData <byte>(10);
            stream.buffer->WriteData <byte>(11);
            stream.buffer->WriteData <byte>(12);
            Assert.DoesNotThrow(() => stream.EmitBlockEnd());

            Assert.Zero(stream.buffer->DataToSendBytes & 3);

            stream.buffer->m_BufferList->Free();
        }