Пример #1
0
        public void ShallowCopyTest()
        {
            var p = new ParentModel
            {
                Id   = 1,
                Name = "Test"
            };

            var c = new ChildModel();

            c.ShallowCopy(p);

            Assert.IsNotNull(c);
            Assert.AreEqual(p.Id, c.Id);
            Assert.AreEqual(p.Name, c.Name);
            Assert.IsNull(c.Description);
        }
Пример #2
0
        public void ShallowCopyMismatchedTest()
        {
            var s = new Sibling
            {
                Id   = 1,
                Name = "Test",
                Age  = 3
            };

            var c = new ChildModel();

            c.ShallowCopy(s);

            Assert.IsNotNull(c);
            Assert.AreEqual(s.Id, c.Id);
            Assert.AreEqual(s.Name, c.Name);
            Assert.IsNull(c.Description);
        }