コード例 #1
0
        public static byte[] GetFilledDataBlockBlob()
        {
            var stream = new MemoryStream();

            using (var buffer = new BinaryWriteBuffer(1024, stream)) {
                var visitor   = new PackedDataWriteVisitor(buffer);
                var traveller = DataBlockHardCodedTraveller.Create();
                traveller.Travel(visitor, DataBlock.Filled());
            }

            var bytes = stream.ToArray();

            return(bytes);
        }
コード例 #2
0
        public void ReadHardCodedTravelTest()
        {
            var bytes   = BinarySerializationTestContext.GetFilledDataBlockBlob();
            var stream  = new MemoryStream(bytes);
            var visitor = new PackedDataReadVisitor(stream);

            var traveller = DataBlockHardCodedTraveller.Create();

            var graph = new DataBlock();

            traveller.Travel(visitor, graph);

            var expected = DataBlock.Filled();

            graph.AssertEqualTo(expected);
        }