Esempio n. 1
0
        public async Task ShouldFailUpdateWorkflowAction_InvalidParams()
        {
            IWorkflowsClient workflowsClient = new WorkflowsClient(_apiClient.Object, _configuration.Object);

            try
            {
                await workflowsClient.UpdateWorkflowAction("", "action_id", new WebhookWorkflowActionRequest());

                throw new XunitException();
            }
            catch (Exception ex)
            {
                ex.ShouldBeOfType(typeof(CheckoutArgumentException));
                ex.Message.ShouldBe("workflowId cannot be blank");
            }

            try
            {
                await workflowsClient.UpdateWorkflowAction("12345", "", new WebhookWorkflowActionRequest());

                throw new XunitException();
            }
            catch (Exception ex)
            {
                ex.ShouldBeOfType(typeof(CheckoutArgumentException));
                ex.Message.ShouldBe("actionId cannot be blank");
            }

            try
            {
                await workflowsClient.UpdateWorkflowAction("12345", "46562", null);

                throw new XunitException();
            }
            catch (Exception ex)
            {
                ex.ShouldBeOfType(typeof(CheckoutArgumentException));
                ex.Message.ShouldBe("workflowActionRequest cannot be null");
            }
        }
Esempio n. 2
0
        public async Task ShouldUpdateWorkflowAction()
        {
            WebhookWorkflowActionRequest workflowActionRequest = new WebhookWorkflowActionRequest();

            _apiClient.Setup(apiClient =>
                             apiClient.Put <EmptyResponse>("workflows" + "/workflow_id/actions/action_id", _authorization,
                                                           workflowActionRequest, CancellationToken.None, null))
            .ReturnsAsync(() => new EmptyResponse());

            IWorkflowsClient workflowsClient = new WorkflowsClient(_apiClient.Object, _configuration.Object);

            var getResponse =
                await workflowsClient.UpdateWorkflowAction("workflow_id", "action_id", workflowActionRequest);

            getResponse.ShouldNotBeNull();
        }