public void FlatCloneTest()
        {
            var a = new TestFlatClass {
                Text = "old text", Number = 1
            };

            var b = a.Clone();

            a.Text   = "new text";
            a.Number = 2;

            b.Text.Should().Be("old text");
            b.Number.Should().Be(1);
        }
        public void ReferenceCloneTest()
        {
            var customA = new TestFlatClass {
                Text = "old text", Number = 1
            };
            var a = new TestComplexClass {
                Custom = customA
            };

            var b = a.Clone();

            a.Custom.Text   = "new text";
            a.Custom.Number = 2;

            b.Custom.Should().NotBeSameAs(customA, "deep clone must create a new instance");
            b.Custom.Text.Should().Be("old text");
            b.Custom.Number.Should().Be(1);
        }
        public void PartialCopyTest()
        {
            const string textValue  = "magictextvalue";
            const int    numValue   = 574842389;
            const float  floatValue = 1.58067453f;
            var          a          = new TestFlatClass();

            a.Text   = textValue;
            a.Number = numValue;
            var b = new TestDerivedClass();

            b.FloatNumber = floatValue;

            b.PartialCopy(a);

            b.Text.Should().Be(textValue);
            b.Number.Should().Be(numValue);
            b.FloatNumber.Should().Be(floatValue);
        }