public void setup() { //TODO looking to bogus for fake test data generation name = new ContactNameDTO { first = "Paul", middle = "Muad Dib", last = "Atreides" }; address = new ContactAddressDTO { state = "Arrakis", city = "Sietch Tabr", street = "100 sietch lane", zip = "10000" }; phones = new List <ContactPhoneDTO>(); ContactPhoneDTO phoneDTO = new ContactPhoneDTO { type = "mobile", number = "100-100-100" }; phones.Add(phoneDTO); contactResponseDTO = new ContactResponseDTO { Id = 1, name = name, address = address, phone = phones, email = "*****@*****.**" }; phoneEntities = new List <PhoneEntity>(); PhoneEntity phone = new PhoneEntity { type = "mobile", number = "100-100-100" }; phoneEntities.Add(phone); contactsEntity = new ContactsEntity { first = "Paul", middle = "Muad Dib", last = "Atreides", state = "Arrakis", city = "Sietch Tabr", street = "100 sietch lane", zip = "10000", phones = phoneEntities, email = "*****@*****.**" }; }
public ContactResponseDTO convertEntityToDTO(ContactsEntity contactsEntity) { ContactAddressDTO address = new ContactAddressDTO { state = contactsEntity.state, street = contactsEntity.street, city = contactsEntity.city, zip = contactsEntity.zip }; ContactNameDTO name = new ContactNameDTO { first = contactsEntity.first, middle = contactsEntity.middle, last = contactsEntity.last }; List <ContactPhoneDTO> phones = new List <ContactPhoneDTO>(); foreach (PhoneEntity phone in contactsEntity.phones) { ContactPhoneDTO phoneDTO = new ContactPhoneDTO { type = phone.type, number = phone.number }; phones.Add(phoneDTO); } ContactResponseDTO response = new ContactResponseDTO { Id = contactsEntity.Id, name = name, address = address, phone = phones, email = contactsEntity.email }; return(response); }