public void ToMessageWithNullResponseData()
        {
            var serializers = new Mock <IStoreObjectSerializers>();
            {
                serializers.Setup(s => s.HasSerializerFor(It.IsAny <Type>()))
                .Callback <Type>(t => Assert.IsTrue(typeof(double).Equals(t)))
                .Returns(true);
                serializers.Setup(s => s.SerializerFor(It.IsAny <Type>()))
                .Returns(new NonTransformingObjectSerializer());
            }

            var translator = new ConnectionVerificationResponseConverter(serializers.Object);

            var data = new ConnectionVerificationResponseData
            {
                Id           = new MessageId(),
                InResponseTo = new MessageId(),
                Sender       = new EndpointId("a"),
                DataType     = new SerializedType
                {
                    FullName     = typeof(object).FullName,
                    AssemblyName = typeof(object).Assembly.GetName().Name
                },
                ResponseData = null
            };
            var msg = translator.ToMessage(data);

            Assert.IsInstanceOf(typeof(ConnectionVerificationResponseMessage), msg);
            Assert.AreSame(data.Id, msg.Id);
            Assert.AreSame(data.Sender, msg.Sender);
            Assert.IsNull(((ConnectionVerificationResponseMessage)msg).ResponseData);
        }
        public void ToMessageWithNonMatchingDataType()
        {
            var serializers = new Mock <IStoreObjectSerializers>();
            var translator  = new ConnectionVerificationResponseConverter(serializers.Object);

            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);
        }