Esempio n. 1
0
        public async stt::Task GetExecutionResourceNamesAsync()
        {
            moq::Mock <Executions.ExecutionsClient> mockGrpcClient = new moq::Mock <Executions.ExecutionsClient>(moq::MockBehavior.Strict);
            GetExecutionRequest request = new GetExecutionRequest
            {
                ExecutionName = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[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.GetExecutionAsync(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.GetExecutionAsync(request.ExecutionName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 2
0
        public void GetExecutionResourceNames()
        {
            moq::Mock <Executions.ExecutionsClient> mockGrpcClient = new moq::Mock <Executions.ExecutionsClient>(moq::MockBehavior.Strict);
            GetExecutionRequest request = new GetExecutionRequest
            {
                ExecutionName = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[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.GetExecution(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ExecutionsClient client   = new ExecutionsClientImpl(mockGrpcClient.Object, null);
            Execution        response = client.GetExecution(request.ExecutionName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetExecution</summary>
 public void GetExecutionRequestObject()
 {
     // Snippet: GetExecution(GetExecutionRequest, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     GetExecutionRequest request = new GetExecutionRequest
     {
         ExecutionName = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]"),
         View          = ExecutionView.Unspecified,
     };
     // Make the request
     Execution response = executionsClient.GetExecution(request);
     // End snippet
 }
        /// <summary>Snippet for GetExecutionAsync</summary>
        public async Task GetExecutionRequestObjectAsync()
        {
            // Snippet: GetExecutionAsync(GetExecutionRequest, CallSettings)
            // Additional: GetExecutionAsync(GetExecutionRequest, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            GetExecutionRequest request = new GetExecutionRequest
            {
                ExecutionName = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]"),
                View          = ExecutionView.Unspecified,
            };
            // Make the request
            Execution response = await executionsClient.GetExecutionAsync(request);

            // End snippet
        }