Esempio n. 1
0
        public async Task ShouldCreateWorkflow()
        {
            CreateWorkflowRequest  createWorkflowRequest  = new CreateWorkflowRequest();
            CreateWorkflowResponse createWorkflowResponse = new CreateWorkflowResponse();

            _apiClient.Setup(apiClient =>
                             apiClient.Post <CreateWorkflowResponse>("workflows", _authorization,
                                                                     createWorkflowRequest, CancellationToken.None, null))
            .ReturnsAsync(() => createWorkflowResponse);

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

            var response = await workflowsClient.CreateWorkflow(createWorkflowRequest);

            response.ShouldNotBeNull();
        }
Esempio n. 2
0
        public async Task ShouldFailCreateWorkflow_InvalidParams()
        {
            CreateWorkflowRequest  createWorkflowRequest  = new CreateWorkflowRequest();
            CreateWorkflowResponse createWorkflowResponse = new CreateWorkflowResponse();

            _apiClient.Setup(apiClient =>
                             apiClient.Post <CreateWorkflowResponse>("workflows", _authorization,
                                                                     createWorkflowRequest, CancellationToken.None, null))
            .ReturnsAsync(() => createWorkflowResponse);

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

            try
            {
                await workflowsClient.CreateWorkflow(null);

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