public async Task When_serializing_should_produce_correct_binary_data()
        {
            byte[] fakeControllerData = { 0x20, 0x6c, 0x61, 0x62 };
            byte[] expectedRawData    = new byte[] { 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
            .Concat(fakeControllerData)
            .ToArray();

            _controllerWriterMock
            .Setup(m => m.Write(It.IsAny <Stream>(), It.IsAny <object>()))
            .Callback <Stream, object>((ms, _) => ms.Write(fakeControllerData, 0, fakeControllerData.Length));

            var controller = new object();
            var chunk      = new ControllerDataChunk(
                _controllerReaderMock.Object,
                _controllerWriterMock.Object
                )
            {
                ParentId       = 123,
                ControllerData = controller
            };

            using (var ms = new MemoryStream())
            {
                // Act
                await chunk.SerializeAsync(ms, false);

                // Assert
                ms.ToArray().Should().BeEquivalentTo(expectedRawData);
                _controllerWriterMock.Verify(m => m.Write(ms, controller), Times.Once);
            }
        }
        public async Task Given_controller_data_is_not_accessed_when_serializing_should_rewrite_from_buffer()
        {
            byte[] fakeControllerData = { 0x20, 0x6c, 0x61, 0x62 };
            byte[] rawData            = new byte[] { 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
            .Concat(fakeControllerData)
            .ToArray();

            using (var ms = new MemoryStream(rawData))
            {
                // Act
                await _sut.DeserializeAsync(ms, false);

                ms.SetLength(0);

                await _sut.SerializeAsync(ms, false);

                // Assert
                ms.ToArray().Should().BeEquivalentTo(rawData);
                _controllerWriterMock.Verify(m => m.Write(It.IsAny <Stream>(), It.IsAny <object>()), Times.Never);
            }
        }