예제 #1
0
        public void ExampleUsage2()
        {
            MyClass2 originalClass2 = new MyClass2()
            {
                name = "1", child = new MyClass2()
                {
                    name = "2"
                }
            };

            MyClass1 mappedClass1 = originalClass2.MapViaJsonInto <MyClass1>();

            Assert.Equal(originalClass2.child.name, mappedClass1.child.name);
            // Modify the copy, changing the copy will not change the original:
            mappedClass1.child.name = "Some new name..";
            // Check that the change was only done in the copy and not the original:
            Assert.NotEqual(originalClass2.child.name, mappedClass1.child.name);
        }