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); }
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); }
public async Task Test_Larg_Inherit_Ctor() { TestCtorB a = new TestCtorB("A", 0); await Test(a, checkTestCtorA(a), largCtorOptions); a.C = "C"; await Test(a, checkTestCtorA(a), largCtorOptions); }
public async Task Test_Simple_Inherit_Ctor() { TestCtorB a = new TestCtorB("A", 0); await Test(a, checkTestCtorA(a)); a.C = "C"; await Test(a, checkTestCtorA(a)); }
internal Action <TestCtorA> checkCtorCProc(TestCtorA a) { Action <TestCtorA> check = b => { Assert.Equal(a.GetType(), b.GetType()); Assert.Equal(a.A, b.A); Assert.Equal(a.B, b.B); if (a is TestCtorB cb) { TestCtorB cb2 = b as TestCtorB; Assert.Equal(cb.C, cb2.C); Assert.Equal(cb.EnumA, cb2.EnumA); if (cb.TestA == null) { Assert.Null(cb2.TestA); } else { checkTestAProc(cb.TestA)(cb2.TestA); } } if (a is TestCtorC cc) { TestCtorB p1 = cc.Parent; TestCtorB p2 = (b as TestCtorC).Parent; if (p1 == null) { Assert.Null(p2); } else { checkCtorCProc(p1).Invoke(p2); } TestCtorA t1 = cc.Temp; TestCtorA t2 = (b as TestCtorC).Temp; if (t1 == null) { Assert.Null(t2); } else { checkCtorCProc(t1).Invoke(t2); } } }; return(check); }
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 TestCtorC(TestCtorB parent, TestCtorA temp) : base(parent.A, parent.B) { Temp = temp; Parent = parent; }