Beispiel #1
0
        public static void Test(object value, Type innerType, Func <IProtoSerializer, IProtoSerializer> ctor,
                                string expectedHex)
        {
            byte[] expected = new byte[expectedHex.Length / 2];
            for (int i = 0; i < expected.Length; i++)
            {
                expected[i] = (byte)Convert.ToInt32(expectedHex.Substring(i * 2, 2), 16);
            }
            NilSerializer nil = new NilSerializer(innerType);
            var           ser = ctor(nil);

            var decorator = RuntimeTypeModel.GetSerializer(ser, false);

            Test(value, decorator, "decorator", expected);

            var compiled = RuntimeTypeModel.GetSerializer(ser, true);

            Test(value, compiled, "compiled", expected);
        }