public void ToMessageWithNonMatchingDataType() { var translator = new NotificationUnregistrationConverter(); var data = new SuccessData { Id = new MessageId(), InResponseTo = new MessageId(), Sender = new EndpointId("a"), }; var msg = translator.ToMessage(data); Assert.IsInstanceOf(typeof(UnknownMessageTypeMessage), msg); Assert.AreSame(data.Id, msg.Id); Assert.AreSame(data.Sender, msg.Sender); Assert.AreSame(data.InResponseTo, msg.InResponseTo); }
public void ToMessage() { var translator = new NotificationUnregistrationConverter(); var id = NotificationId.Create(typeof(InteractionExtensionsTest.IMockNotificationSetWithTypedEventHandler).GetEvent("OnMyEvent")); var data = new NotificationUnregistrationData { Id = new MessageId(), InResponseTo = new MessageId(), Sender = new EndpointId("a"), NotificationId = NotificationIdExtensions.Serialize(id), }; var msg = translator.ToMessage(data); Assert.IsInstanceOf(typeof(UnregisterFromNotificationMessage), msg); Assert.AreSame(data.Id, msg.Id); Assert.AreSame(data.Sender, msg.Sender); Assert.AreEqual(id, ((UnregisterFromNotificationMessage)msg).Notification); }