예제 #1
0
 public void StructuredBinaryTest()
 {
     Check(GetList(), () => new StructuredBinaryWriter(), w =>
     {
         StructuredBinaryWriter bw = (StructuredBinaryWriter)w;
         return(bw.ConstructReader());
     });
 }
예제 #2
0
        public void DoTest()
        {
            var guid = typeof(Root).GUID;


            Root r0 = new Root();

            r0.sa      = new SA();
            r0.sa.x    = 3;
            r0.a       = new CA();
            r0.a.self  = r0.a;
            r0.a.y     = 7;
            r0.a.hello = "hello";

            StructuredBinaryReader dataReader;
            {
                var dataWriter = new StructuredBinaryWriter();
                var writer     = new GraphSerializer(dataWriter, new TypenameBasedTypeSerializer(), 1);

                writer.AddClass(ref r0);

                dataReader = dataWriter.ConstructReader();
            }

            {
                var reader = new GraphDeserializer(dataReader, new TypenameBasedTypeDeserializer());

                reader.OnException += (ex) =>
                {
                    Assert.Fail(ex.ToString());
                };

                Root r1 = null;
                reader.AddClass(ref r1);
            }
        }