Beispiel #1
0
        public async stt::Task CreateExecutionRequestObjectAsync()
        {
            moq::Mock <Executions.ExecutionsClient> mockGrpcClient = new moq::Mock <Executions.ExecutionsClient>(moq::MockBehavior.Strict);
            CreateExecutionRequest request = new CreateExecutionRequest
            {
                ParentAsWorkflowName = gcwcv::WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                Execution            = new Execution(),
            };
            Execution expectedResponse = new Execution
            {
                ExecutionName      = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]"),
                StartTime          = new wkt::Timestamp(),
                EndTime            = new wkt::Timestamp(),
                State              = Execution.Types.State.Failed,
                Argument           = "argument60e0cd03",
                Result             = "result1784a8b4",
                Error              = new Execution.Types.Error(),
                WorkflowRevisionId = "workflow_revision_id3b9c4f02",
            };

            mockGrpcClient.Setup(x => x.CreateExecutionAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Execution>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ExecutionsClient client = new ExecutionsClientImpl(mockGrpcClient.Object, null);
            Execution        responseCallSettings = await client.CreateExecutionAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Execution responseCancellationToken = await client.CreateExecutionAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public void CreateExecution()
        {
            moq::Mock <Executions.ExecutionsClient> mockGrpcClient = new moq::Mock <Executions.ExecutionsClient>(moq::MockBehavior.Strict);
            CreateExecutionRequest request = new CreateExecutionRequest
            {
                ParentAsWorkflowName = gcwcv::WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                Execution            = new Execution(),
            };
            Execution expectedResponse = new Execution
            {
                ExecutionName      = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]"),
                StartTime          = new wkt::Timestamp(),
                EndTime            = new wkt::Timestamp(),
                State              = Execution.Types.State.Failed,
                Argument           = "argument60e0cd03",
                Result             = "result1784a8b4",
                Error              = new Execution.Types.Error(),
                WorkflowRevisionId = "workflow_revision_id3b9c4f02",
            };

            mockGrpcClient.Setup(x => x.CreateExecution(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ExecutionsClient client   = new ExecutionsClientImpl(mockGrpcClient.Object, null);
            Execution        response = client.CreateExecution(request.Parent, request.Execution);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for CreateExecution</summary>
 public void CreateExecutionRequestObject()
 {
     // Snippet: CreateExecution(CreateExecutionRequest, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     CreateExecutionRequest request = new CreateExecutionRequest
     {
         ParentAsWorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
         Execution            = new Execution(),
     };
     // Make the request
     Execution response = executionsClient.CreateExecution(request);
     // End snippet
 }
        private async Task <Execution> ExecuteWorkflow(string projectId, string region, string workflow, string args)
        {
            var client = await ExecutionsClient.CreateAsync();

            var request = new CreateExecutionRequest()
            {
                Parent    = WorkflowName.Format(projectId, region, workflow),
                Execution = new Execution()
                {
                    Argument = args
                }
            };

            var response = await client.CreateExecutionAsync(request);

            return(response);
        }
        /// <summary>Snippet for CreateExecutionAsync</summary>
        public async Task CreateExecutionRequestObjectAsync()
        {
            // Snippet: CreateExecutionAsync(CreateExecutionRequest, CallSettings)
            // Additional: CreateExecutionAsync(CreateExecutionRequest, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            CreateExecutionRequest request = new CreateExecutionRequest
            {
                ParentAsWorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                Execution            = new Execution(),
            };
            // Make the request
            Execution response = await executionsClient.CreateExecutionAsync(request);

            // End snippet
        }