示例#1
0
        public void FromMessageWithNonMatchingMessageType()
        {
            var translator = new NotificationRegistrationConverter();

            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 NotificationRegistrationConverter();

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

            var data = translator.FromMessage(msg);

            Assert.IsInstanceOf(typeof(NotificationRegistrationData), data);
            Assert.AreSame(msg.Id, data.Id);
            Assert.AreSame(msg.Sender, data.Sender);
            Assert.AreSame(msg.InResponseTo, data.InResponseTo);
            Assert.AreEqual(NotificationIdExtensions.Serialize(id), ((NotificationRegistrationData)data).NotificationId);
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
0
        public void DataTypeToTranslate()
        {
            var translator = new NotificationRegistrationConverter();

            Assert.AreEqual(typeof(NotificationRegistrationData), translator.DataTypeToTranslate);
        }
示例#6
0
        public void MessageTypeToTranslate()
        {
            var translator = new NotificationRegistrationConverter();

            Assert.AreEqual(typeof(RegisterForNotificationMessage), translator.MessageTypeToTranslate);
        }