Exemple #1
0
 private void VerifyCustomerDto(CustomerDto customerDto)
 {
     Assert.AreEqual(21, customerDto.Years);
     Assert.AreEqual(181, customerDto.Height);
     Assert.AreEqual("Doe", customerDto.Surname);
     Assert.AreEqual("Jon", customerDto.Name);
     Assert.AreEqual(75, customerDto.Weight);
 }
Exemple #2
0
        public void Ignore_Copy_Member_Teset()
        {
            Mapper.CreateMap<Customer, CustomerDto>().ForMember(x => x.Name, x => x.Ignore(false));

            Customer customer = GenerateCustomer();

            CustomerDto customerDto = new CustomerDto { Name = "OldName" };
            Mapper.Map(customer, customerDto);

            CustomerDto newCustomerDto = Mapper.Map<Customer, CustomerDto>(customer);

            Assert.AreEqual(customer.Name, customerDto.Name);
            Assert.AreNotEqual(customer.Name, newCustomerDto.Name);
        }
Exemple #3
0
        private CustomerDto GenerateCustomerDto()
        {
            CustomerDto customer = new CustomerDto
            {
                Years = 23,
                Height = 175,
                Surname = "Snow",
                Name = "Mark",
                Weight = 85
            };

            return customer;
        }