public void Should_handle_interface_message_with_interface_property() { var messageMapper = new MessageMapper(); messageMapper.Initialize(new[] { typeof(IMessageWithInterfaceProperty) }); var serializer = new JsonMessageSerializer(messageMapper); IMessageWithInterfaceProperty message = new InterfaceMessageWithInterfacePropertyImplementation { InterfaceProperty = new InterfacePropertyImplementation { SomeProperty = "test" } }; using (var stream = new MemoryStream()) { serializer.Serialize(message, stream); stream.Position = 0; var result = (IMessageWithInterfaceProperty)serializer.Deserialize(stream, new[] { typeof(IMessageWithInterfaceProperty) })[0]; Assert.AreEqual(message.InterfaceProperty.SomeProperty, result.InterfaceProperty.SomeProperty); } }
public void Should_handle_interface_message_with_interface_property() { var messageMapper = new MessageMapper(); messageMapper.Initialize(new[] { typeof(IMessageWithInterfaceProperty) }); var serializer = new JsonMessageSerializer(messageMapper); IMessageWithInterfaceProperty message = new InterfaceMessageWithInterfacePropertyImplementation { InterfaceProperty = new InterfacePropertyImplementation { SomeProperty = "test" } }; using (var stream = new MemoryStream()) { serializer.Serialize(message, stream); stream.Position = 0; var result = (IMessageWithInterfaceProperty) serializer.Deserialize(stream, new[] { typeof(IMessageWithInterfaceProperty) })[0]; Assert.AreEqual(message.InterfaceProperty.SomeProperty, result.InterfaceProperty.SomeProperty); } }