Ejemplo n.º 1
0
        public void CopyPropertiesTest2()
        {
            var address = new CompleteAddress() { Id = 0, City = "Rennes", Street = "rue de la paix", State=33, Country="France" };
            var email1 = "*****@*****.**";
            var email2 = "*****@*****.**"; 
            var emails = new List<string>() { email1, email2};

            var objOrigin = new Customer { Id = 0, Address = address, Emails = emails };
            var objDestination = new Employee();

            CopyUtils.CopyProperties(objDestination, objOrigin);

            Assert.IsTrue(objDestination.Id.Equals(objOrigin.Id));
            Assert.IsNull(objDestination.Name);
            Assert.IsTrue(objDestination.Address.Equals(objOrigin.Address));
        }
Ejemplo n.º 2
0
        public void CopyPropertiesTest1() {

            var pi1 = new PhoneItem() { FaxNumber = "456598784532", PhoneNumber = "124565789854" };
            var pi2 = new PhoneItem() { FaxNumber = "789874654312", PhoneNumber = "684763251325" };
            var phoneItems = new List<PhoneItem>() { pi1, pi2 };
            var address = new Address() { Id = 1, City = "Rennes", Street = "rue de la paix" };

            var objOrigin = new Employee { Id = 0, Name = "Bernard", Password = "******", Address = address, PhoneItems = phoneItems };
            var objDestination = new Customer();

            CopyUtils.CopyProperties(objDestination, objOrigin);

            Assert.IsTrue(objDestination.Id.Equals(objOrigin.Id));
            Assert.IsNull(objDestination.GetName());
            Assert.IsNull(objDestination.Address);
            Assert.IsNull(objDestination.Emails);
        }