public TestRefWithCtor(TestRefWithCtor parent)
 {
     Parent = parent;
     if (parent != null)
     {
         parent.Child = this;
     }
 }
Esempio n. 2
0
        public async Task Test_Ctor_With_Parent_Child_Ref()
        {
            TestRefWithCtor p = new TestRefWithCtor(null)
            {
                A = "A"
            };
            TestRefWithCtor a = new TestRefWithCtor(p)
            {
                A = "B"
            };


            await Test(a, b =>
            {
                Assert.True(Object.ReferenceEquals(b.Parent.Child, b));
                Assert.True(Object.ReferenceEquals(b.Parent.Child.Parent, b.Parent));
                Assert.Equal("A", b.Parent.A);
                Assert.Equal("B", b.A);
            }, new BinarySerializerOptions()
            {
                DefaultBufferSize = 1
            });
        }