Exemple #1
0
        public async Task Test_Larg_Object_Ctor()
        {
            TestCtorB b = new TestCtorB("B", 1);

            b.C = "C";
            TestCtorA a = new TestCtorA("A", 1);

            TestCtorC c = new TestCtorC(b, a);

            await Test <TestCtorC>(c, checkCtorCProc(c), largCtorOptions);

            b.TestA = new ObjTestB()
            {
                A = 1,
                D = new ObjTestB()
                {
                    A = 1,
                    B = "B",
                    D = new ObjTestA()
                    {
                        A = 2
                    }
                },
                E = 1,
                C = new ObjTestB()
                {
                    A = 1,
                    B = "B"
                }
            };

            await Test <TestCtorC>(c, checkCtorCProc(c), largCtorOptions);
        }
Exemple #2
0
        internal TestCtorC createComplexCtorC(int len)
        {
            TestCtorB b = new TestCtorB(new string('B', len), 1);

            b.C = new string('C', len);
            TestCtorA a = new TestCtorC(new TestCtorC(
                                            new TestCtorB(new string('B', len), 1),
                                            new TestCtorB(new string('B', len), 1))
            {
                TestA = new ObjTestB()
                {
                    E = 1,
                    B = new string('B', len),
                }
            },
                                        new TestCtorB(new string('A', len), 1)
            {
                TestA = new ObjTestA()
                {
                    B = new string('B', len),
                    A = 1
                },
                C     = new string('C', len),
                EnumA = TestEnumA.A
            });


            TestCtorC c = new TestCtorC(b, a);

            return(c);
        }
Exemple #3
0
        public async Task Test_Larg_Object_Ctor_Buffer(int len)
        {
            BinarySerializerOptions options = new BinarySerializerOptions()
            {
                DefaultBufferSize = 1,
                IgnoreCtorParameterCountThreshold = true
            };

            TestCtorB b = new TestCtorB(new string('B', len), 1);

            b.C = new string('C', len);
            TestCtorA a = new TestCtorA(new string('A', len), 1);

            TestCtorC c = new TestCtorC(b, a);

            await Test <TestCtorC>(c, checkCtorCProc(c), options);



            b.TestA = new ObjTestB()
            {
                A = 1,
                D = new ObjTestB()
                {
                    A = 1,
                    B = new string('B', len),
                    D = new ObjTestA()
                    {
                        A = 2
                    }
                },
                E = 1,
                C = new ObjTestB()
                {
                    A = 1,
                    B = new string('B', len)
                }
            };

            options = new BinarySerializerOptions()
            {
                DefaultBufferSize = 32
            };
            await Test <TestCtorC>(c, checkCtorCProc(c), options);
        }
        public async Task Test_Complex_KeyValuePair_Ctor_Buffer(int len)
        {
            BinarySerializerOptions options = new BinarySerializerOptions()
            {
                DefaultBufferSize = 1
            };

            TestCtorC cKey   = createComplexCtorC(len);
            TestCtorC cValue = createComplexCtorC(len);

            var kv = new KeyValuePair <TestCtorA, TestCtorA>(cKey, cValue);

            await Test(kv, (b) =>
            {
                checkCtorCProc(kv.Key)(b.Key);
                checkCtorCProc(kv.Value)(b.Value);
            }, options);
        }
        public async Task Test_Simple_Object_Ctor_With_Polymorphic_Buffer(int len)
        {
            BinarySerializerOptions options = new BinarySerializerOptions()
            {
                DefaultBufferSize = 1
            };

            TestCtorC c = createComplexCtorC(len);

            await Test <TestCtorA>(c, checkCtorCProc(c), options);


            c.Parent.TestA = new ObjTestB()
            {
                A = 1,
                D = new ObjTestB()
                {
                    A = 1,
                    B = new string('B', len),
                    D = new ObjTestA()
                    {
                        A = 2
                    }
                },
                E = 1,
                C = new ObjTestB()
                {
                    A = 1,
                    B = new string('B', len)
                }
            };

            options = new BinarySerializerOptions()
            {
                DefaultBufferSize = 32
            };
            await Test <TestCtorA>(c, checkCtorCProc(c), options);
        }