Example #1
0
        public void CopyFromSameType_Field_ValueType()
        {
            var orig = new SettingsA();
            var copy = new SettingsA();

            orig.IntegerFieldA = 3;

            copy.CopyValuesFrom(orig);

            Assert.AreEqual(3, copy.IntegerFieldA);
        }
Example #2
0
        public void CloneFromParent()
        {
            var orig = new SettingsA();

            orig.IntegerFieldA = 4;

            var copy = orig.CloneAs <SettingsB>();

            Assert.IsNotNull(copy);
            Assert.AreEqual(4, copy.IntegerFieldA);
        }
Example #3
0
        public void CopyFromParent_Field_ValueType()
        {
            var orig = new SettingsA();
            var copy = new SettingsB();

            orig.IntegerFieldA = 8;

            copy.CopyValuesFrom(orig);

            Assert.AreEqual(8, copy.IntegerFieldA);
        }
Example #4
0
        public void CopyFromSameType_Property_ValueType()
        {
            var orig = new SettingsA();
            var copy = new SettingsA();

            orig.IntegerPropertyA = 5;

            copy.CopyValuesFrom(orig);

            Assert.AreEqual(5, copy.IntegerPropertyA);
        }
Example #5
0
        public void CopyFromChild_Field_ValueType()
        {
            var orig = new SettingsB();
            var copy = new SettingsA();

            orig.IntegerFieldA = 7;

            SettingsPrototype.CopyValuesFrom(copy, orig);

            Assert.AreEqual(7, copy.IntegerFieldA);
        }
Example #6
0
        public void Clone_StringsIndependant()
        {
            var orig = new SettingsA();

            orig.StringFieldA = "hello";

            var copy = orig.CloneAs <SettingsA>();

            orig.StringFieldA = "world";

            Assert.AreEqual("hello", copy.StringFieldA);
        }