public void TestCreateNewContact() { Guid id = Guid.NewGuid(); Contact newContact = new Contact(id, "Milivoj", "Milani", "+385989059120", new ContactAddress("Tonžino 7b", "Rijeka", "51000", "Croatia")); _contactOrganizerSqlRepository.CreateNewContact(newContact); Assert.AreEqual(id, _contactOrganizerSqlRepository.GetContactById(id).Id); }
/// <summary> /// Creates a new contact and saves it to external store. /// </summary> /// <param name="contactDetails">Contact details value object.</param> /// <returns>New Contact created.</returns> public Contact CreateNewContact(IContactDetails contactDetails) { ContactDetailsValidator contactDetailsValidator = new ContactDetailsValidator(); contactDetailsValidator.ValidateAndThrow(contactDetails); ContactAddress contactAddress = new ContactAddress(contactDetails.StreetAndNumber, contactDetails.City, contactDetails.PostalCode, contactDetails.Country); Contact newContact = new Contact(Guid.NewGuid(), contactDetails.FirstName, contactDetails.LastName, contactDetails.TelephoneNumber, contactAddress); _contactOrganizerRepository.CreateNewContact(newContact); return(newContact); }