public void CanTranscode()
        {
            using (var stream1 = new MemoryStream())
                using (var stream2 = new MemoryStream())
                    using (var writerStream1 = new WriterStream(stream1))
                        using (var writerStream2 = new WriterStream(stream2))
                        {
                            // write into compact binary protocol first
                            var writer = writerStream1.CreateCompactBinaryWriter();
                            writer.Write(this.testObject);
                            stream1.Position = 0;
                            using (var readerStream1 = ReaderStream.FromMemoryStreamBuffer(stream1, null))
                            {
                                var reader = readerStream1.CreateCompactBinaryReader();
                                // re-write as simple protocol
                                var writer2 = writerStream2.CreateSimpleBinaryWriter();
                                Transcode.FromTo(reader, writer2);
                                stream2.Position = 0;

                                using (var readerStream2 = new ReaderStream(stream2))
                                {
                                    var reader2       = readerStream2.CreateSimpleBinaryReader();
                                    var anotherObject = reader2.Read <AnotherDerivedThing>();

                                    Assert.IsTrue(Comparer.Equal(anotherObject, this.testObject));
                                }
                            }
                        }
        }
        public void CanReadAndWriteSimpleProtocol()
        {
            using (var stream = new MemoryStream())
                using (var writerStream = new WriterStream(stream, this.mgr))
                {
                    var writer = writerStream.CreateSimpleBinaryWriter();
                    writer.Write(this.testObject);

                    stream.Position = 0;
                    using (var reader = ReaderStream.FromMemoryStreamBuffer(stream, this.mgr))
                    {
                        var sbReader      = new SimpleBinaryReader <ReaderStream>(reader);
                        var anotherObject = sbReader.Read <AnotherDerivedThing>();

                        Assert.IsTrue(Comparer.Equal(anotherObject, this.testObject));
                    }
                }
        }