コード例 #1
0
        public void FromMessageWithNonMatchingMessageType()
        {
            var translator = new NotificationUnregistrationConverter();

            var msg  = new SuccessMessage(new EndpointId("a"), new MessageId());
            var data = translator.FromMessage(msg);

            Assert.IsInstanceOf(typeof(UnknownMessageTypeData), data);
            Assert.AreSame(msg.Id, data.Id);
            Assert.AreSame(msg.Sender, data.Sender);
            Assert.AreSame(msg.InResponseTo, data.InResponseTo);
        }
コード例 #2
0
        public void FromMessage()
        {
            var translator = new NotificationUnregistrationConverter();

            var id  = NotificationId.Create(typeof(InteractionExtensionsTest.IMockNotificationSetWithTypedEventHandler).GetEvent("OnMyEvent"));
            var msg = new UnregisterFromNotificationMessage(new EndpointId("a"), id);

            var data = translator.FromMessage(msg);

            Assert.IsInstanceOf(typeof(NotificationUnregistrationData), data);
            Assert.AreSame(msg.Id, data.Id);
            Assert.AreSame(msg.Sender, data.Sender);
            Assert.AreSame(msg.InResponseTo, data.InResponseTo);
            Assert.AreEqual(NotificationIdExtensions.Serialize(id), ((NotificationUnregistrationData)data).NotificationId);
        }