public void GetTask_SendSuccessAndTaskWaitsOnOk_TaskDoesNotComplete()
        {
            var taskManager = new MessageBroker.Client.TaskManager.TaskManager();

            var payloadId = Guid.NewGuid();

            var task = taskManager.Setup(payloadId, true, CancellationToken.None);

            taskManager.OnPayloadSendSuccess(payloadId);

            Assert.False(task.IsCompleted);
        }
        public void GetTask_SendFail_TaskCompletesWithError()
        {
            var taskManager = new MessageBroker.Client.TaskManager.TaskManager();

            var payloadId = Guid.NewGuid();

            var task = taskManager.Setup(payloadId, true, CancellationToken.None);

            taskManager.OnPayloadSendFailed(payloadId);

            var result = task.Result;

            Assert.False(result.IsSuccess);
            Assert.NotNull(result.InternalErrorCode);
        }
        public void GetTask_OkReceived_TaskCompletes()
        {
            var taskManager = new MessageBroker.Client.TaskManager.TaskManager();

            var payloadId = Guid.NewGuid();

            var task = taskManager.Setup(payloadId, true, CancellationToken.None);

            taskManager.OnPayloadOkResult(payloadId);

            var result = task.Result;

            Assert.True(result.IsSuccess);
            Assert.Null(result.InternalErrorCode);
        }