Example #1
0
        public void ToMessageWithNonMatchingDataType()
        {
            var translator = new NotificationRegistrationConverter();

            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);
        }
Example #2
0
        public void ToMessage()
        {
            var translator = new NotificationRegistrationConverter();

            var id   = NotificationId.Create(typeof(InteractionExtensionsTest.IMockNotificationSetWithTypedEventHandler).GetEvent("OnMyEvent"));
            var data = new NotificationRegistrationData
            {
                Id             = new MessageId(),
                InResponseTo   = new MessageId(),
                Sender         = new EndpointId("a"),
                NotificationId = NotificationIdExtensions.Serialize(id),
            };
            var msg = translator.ToMessage(data);

            Assert.IsInstanceOf(typeof(RegisterForNotificationMessage), msg);
            Assert.AreSame(data.Id, msg.Id);
            Assert.AreSame(data.Sender, msg.Sender);
            Assert.AreEqual(id, ((RegisterForNotificationMessage)msg).Notification);
        }