public void VerifyThatUpdateToEmailAddressIsProcessed() { var firstEmail = new EmailAddress(Guid.NewGuid(), this.cache, this.url) { Value = "*****@*****.**" }; this.person.EmailAddress.Add(firstEmail); var secondEmail = new EmailAddress(Guid.NewGuid(), this.cache, this.url) { Value = "*****@*****.**" }; this.person.EmailAddress.Add(secondEmail); this.teamCompositionCardViewModel = new TeamCompositionCardViewModel(this.participant, this.session.Object, null); firstEmail.Value = "*****@*****.**"; var type = firstEmail.GetType(); type.GetProperty("RevisionNumber").SetValue(firstEmail, 50); CDPMessageBus.Current.SendObjectChangeEvent(firstEmail, EventKind.Updated); Assert.AreEqual(firstEmail.Value, this.teamCompositionCardViewModel.EmailAddress); }
public static EmailAddress MapToEmailAddressDB(object source) { Type sourceObject = source.GetType(); Type destination = destinationObject.GetType(); var sourceProperties = sourceObject.GetProperties(); var destinationProperties = destination.GetProperties(); var commonProperties = from sp in sourceProperties join dp in destinationProperties on new { sp.Name, sp.PropertyType } equals new { dp.Name, dp.PropertyType } select new { sp, dp }; foreach (var match in commonProperties) { match.dp.SetValue(destinationObject, match.sp.GetValue(source, null), null); } return(destinationObject); }