public void TestToAdditionalPointOfContact() { var email = "*****@*****.**"; var emailTypeId = EmailAddressType.Business.Id; var phoneNumber = "555"; var phoneNumberTypeId = PhoneNumberType.Business.Id; var newEmailAddress = new AdditionalEmailAddressBindingModel { Address = email, EmailAddressTypeId = emailTypeId, IsPrimary = true }; var newPhoneNumber = new AdditionalPhoneNumberBindingModel { Number = phoneNumber, PhoneNumberTypeId = phoneNumberTypeId, IsPrimary = true }; var model = new AdditionalPointOfContactBindingModel { EmailAddresses = new List <AdditionalEmailAddressBindingModel> { newEmailAddress }, PhoneNumbers = new List <AdditionalPhoneNumberBindingModel> { newPhoneNumber }, FullName = "full Name", Position = "position" }; var user = new User(1); var instance = model.ToAdditionalPointOfContact(user); Assert.AreEqual(user.Id, instance.Audit.User.Id); Assert.AreEqual(model.FullName, instance.FullName); Assert.AreEqual(model.Position, instance.Position); Assert.AreEqual(1, instance.EmailAddresses.Count()); Assert.AreEqual(1, instance.PhoneNumbers.Count()); var firstEmail = instance.EmailAddresses.First(); Assert.AreEqual(email, firstEmail.Address); Assert.AreEqual(emailTypeId, firstEmail.EmailAddressTypeId); Assert.AreEqual(user.Id, firstEmail.Audit.User.Id); Assert.AreEqual(newEmailAddress.IsPrimary, firstEmail.IsPrimary); var firstPhoneNumber = instance.PhoneNumbers.First(); Assert.AreEqual(phoneNumber, firstPhoneNumber.Number); Assert.AreEqual(phoneNumberTypeId, firstPhoneNumber.PhoneNumberTypeId); Assert.AreEqual(user.Id, firstPhoneNumber.Audit.User.Id); Assert.AreEqual(newPhoneNumber.IsPrimary, firstPhoneNumber.IsPrimary); }
public void TestToNewPhoneNumber() { var model = new AdditionalPhoneNumberBindingModel(); model.Number = "5"; model.PhoneNumberTypeId = PhoneNumberType.Cell.Id; model.IsPrimary = true; var user = new User(1); var instance = model.ToNewPhoneNumber(user); Assert.AreEqual(model.Number, instance.Number); Assert.AreEqual(model.PhoneNumberTypeId, instance.PhoneNumberTypeId); Assert.AreEqual(model.IsPrimary, instance.IsPrimary); Assert.AreEqual(user.Id, instance.Audit.User.Id); }