public void Process_MessageNotSerialized_ShouldNotSendResultAndUpdateTask()
        {
            TaskService.Invocations.Clear();
            Sender.Invocations.Clear();

            var taskId    = Guid.NewGuid();
            var queueName = $"{taskId}_queue";
            var message   = "queueName";

            TaskService.Setup(x => x.UpdateStatus(taskId, TaskStatus.Completed, Result));

            TaskService.Setup(x => x.SetError(taskId, ErrorMessage));
            Sender.Setup(x => x.SendMessage(It.IsAny <string>(), It.IsAny <string>()));

            var service = new TestMessageProcessor1(TaskService.Object, Sender.Object);

            service.Process(message);

            TaskService.Verify(x => x.UpdateStatus(taskId, TaskStatus.Completed, Result), Times.Never);
            TaskService.Verify(x => x.SetError(taskId, ErrorMessage), Times.Never);
            Sender.Verify(x => x.SendMessage(It.IsAny <string>(), It.IsAny <string>()), Times.Never);
        }
        public void Process_Success_ShouldSendResultAndUpdateTask()
        {
            TaskService.Invocations.Clear();
            Sender.Invocations.Clear();

            var taskId            = Guid.NewGuid();
            var queueName         = $"{taskId}_queue";
            var message           = "{\"email\" : \"[email protected]\", \"name\": \"test\", \"task_id\":\"" + taskId + "\",\"callback_queue_name\":\"" + queueName + "\"}";
            var callbackQueueName = string.Empty;
            var result            = string.Empty;
            var sendingMessage    = "";

            TaskService.Setup(x => x.UpdateStatus(taskId, TaskStatus.Completed, Result))
            .Callback <Guid, TaskStatus, string>((idParam, statusParam, messageParam) =>
            {
                result = messageParam;
            });

            TaskService.Setup(x => x.SetError(taskId, ErrorMessage));
            Sender.Setup(x => x.SendMessage(It.IsAny <string>(), It.IsAny <string>()))
            .Callback <string, string>((queueParam, messageParam) =>
            {
                callbackQueueName = queueParam;
                sendingMessage    = messageParam;
            });

            var service = new TestMessageProcessor1(TaskService.Object, Sender.Object);

            service.Process(message);

            TaskService.Verify(x => x.UpdateStatus(taskId, TaskStatus.Completed, Result), Times.Once);
            TaskService.Verify(x => x.SetError(taskId, ErrorMessage), Times.Never);
            Sender.Verify(x => x.SendMessage(It.IsAny <string>(), It.IsAny <string>()), Times.Once);
            Assert.AreEqual(callbackQueueName, queueName);
            Assert.AreEqual(sendingMessage, Result);
        }