public void FromMessageWithNonMatchingMessageType() { var serializers = new Mock <IStoreObjectSerializers>(); var translator = new ConnectionVerificationResponseConverter(serializers.Object); 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 FromMessageWithNullResponseData() { var serializers = new Mock <IStoreObjectSerializers>(); { serializers.Setup(s => s.HasSerializerFor(It.IsAny <Type>())) .Returns(true); serializers.Setup(s => s.SerializerFor(It.IsAny <Type>())) .Returns(new NonTransformingObjectSerializer()); } var translator = new ConnectionVerificationResponseConverter(serializers.Object); var msg = new ConnectionVerificationResponseMessage(new EndpointId("a"), new MessageId()); var data = translator.FromMessage(msg); Assert.IsInstanceOf(typeof(ConnectionVerificationResponseData), data); Assert.AreSame(msg.Id, data.Id); Assert.AreSame(msg.Sender, data.Sender); Assert.AreSame(msg.InResponseTo, data.InResponseTo); Assert.AreEqual(typeof(object).FullName, ((ConnectionVerificationResponseData)data).DataType.FullName); Assert.AreEqual(typeof(object).Assembly.GetName().Name, ((ConnectionVerificationResponseData)data).DataType.AssemblyName); Assert.IsNull(((ConnectionVerificationResponseData)data).ResponseData); }