public void FromMessageWithNonMatchingMessageType() { var translator = new EndpointInteractionInformationConverter(); 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); }
public void FromMessage() { var translator = new EndpointInteractionInformationConverter(); var msg = new EndpointInteractionInformationMessage( new EndpointId("a"), new[] { new CommunicationSubjectGroup( new CommunicationSubject("a"), new[] { new VersionedTypeFallback( new Tuple <OfflineTypeInformation, Version>( new OfflineTypeInformation( typeof(int).FullName, typeof(int).Assembly.GetName()), new Version(1, 0))), }, new[] { new VersionedTypeFallback( new Tuple <OfflineTypeInformation, Version>( new OfflineTypeInformation( typeof(double).FullName, typeof(double).Assembly.GetName()), new Version(1, 2))), }), }); var data = translator.FromMessage(msg); Assert.IsInstanceOf(typeof(EndpointInteractionInformationData), data); Assert.AreSame(msg.Id, data.Id); Assert.AreSame(msg.Sender, data.Sender); Assert.AreSame(msg.InResponseTo, data.InResponseTo); Assert.AreEqual(msg.SubjectGroups.Length, ((EndpointInteractionInformationData)data).Groups.Length); Assert.AreEqual( msg.SubjectGroups[0].Subject, new CommunicationSubject(((EndpointInteractionInformationData)data).Groups[0].Subject)); Assert.AreEqual( msg.SubjectGroups[0].Commands.Length, ((EndpointInteractionInformationData)data).Groups[0].Commands.Length); Assert.AreEqual(1, ((EndpointInteractionInformationData)data).Groups[0].Commands[0].Types.Length); Assert.AreEqual( typeof(int).FullName, ((EndpointInteractionInformationData)data).Groups[0].Commands[0].Types[0].Type.FullName); Assert.AreEqual( typeof(int).Assembly.GetName().Name, ((EndpointInteractionInformationData)data).Groups[0].Commands[0].Types[0].Type.AssemblyName); Assert.AreEqual( new Version(1, 0), ((EndpointInteractionInformationData)data).Groups[0].Commands[0].Types[0].Version); Assert.AreEqual( msg.SubjectGroups[0].Notifications.Length, ((EndpointInteractionInformationData)data).Groups[0].Notifications.Length); Assert.AreEqual(1, ((EndpointInteractionInformationData)data).Groups[0].Notifications[0].Types.Length); Assert.AreEqual( typeof(double).FullName, ((EndpointInteractionInformationData)data).Groups[0].Notifications[0].Types[0].Type.FullName); Assert.AreEqual( typeof(double).Assembly.GetName().Name, ((EndpointInteractionInformationData)data).Groups[0].Notifications[0].Types[0].Type.AssemblyName); Assert.AreEqual( new Version(1, 2), ((EndpointInteractionInformationData)data).Groups[0].Notifications[0].Types[0].Version); }