Example #1
0
        public void TestStruct()
        {
            TestGen(cl => {
                var src = new SamplePoint {
                    X = 1, Y = 4
                };
                var dst = cl.Deep(src);
                Assert.AreEqual(src, dst);
            });

            TestGen(cl => {
                var src = new SampleRect {
                    A = new SamplePoint {
                        X = 1, Y = 4
                    },
                    B = new SamplePoint {
                        X = 5, Y = 2
                    },
                };
                var dst = cl.Deep(src);
                Assert.AreNotEqual(src, dst);
                Assert.AreEqual(src.A, dst.A);
                Assert.AreEqual(src.B, dst.B);
            });

            TestGen(cl => {
                var src = new SampleStructWithClass {
                    A = new Sample1 {
                        X = 14
                    }
                };
                var dst = cl.Deep(src);
                Assert.AreNotEqual(src.A, dst.A);
                Assert.AreEqual(src.A.X, dst.A.X);
            });
        }
Example #2
0
 public static SampleCompactSurrogate FromSurrogate(SamplePoint obj)
 {
     return(new SampleCompactSurrogate {
         X = obj.X, Y = obj.Y
     });
 }
Example #3
0
 public SampleDefault()
 {
     P = new SamplePoint {
         X = 7, Y = 2
     };
 }