Beispiel #1
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();
        }