コード例 #1
0
        public void ExecuteQuestion()
        {
            moq::Mock <QuestionService.QuestionServiceClient> mockGrpcClient = new moq::Mock <QuestionService.QuestionServiceClient>(moq::MockBehavior.Strict);
            ExecuteQuestionRequest request = new ExecuteQuestionRequest
            {
                Name = "name1c9368b0",
                InterpretationIndex = -988014087,
            };
            Question expectedResponse = new Question
            {
                QuestionName          = QuestionName.FromProjectLocationQuestion("[PROJECT]", "[LOCATION]", "[QUESTION]"),
                Scopes                = { "scopes35c99a1e", },
                Query                 = "queryf0c71c1b",
                DataSourceAnnotations =
                {
                    "data_source_annotationscbcadb22",
                },
                InterpretError  = new InterpretError(),
                Interpretations =
                {
                    new Interpretation(),
                },
                CreateTime = new wkt::Timestamp(),
                UserEmail  = "user_emaildc7bc240",
                DebugFlags = new DebugFlags(),
                DebugInfo  = new wkt::Any(),
            };

            mockGrpcClient.Setup(x => x.ExecuteQuestion(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            QuestionServiceClient client = new QuestionServiceClientImpl(mockGrpcClient.Object, null);
            Question response            = client.ExecuteQuestion(request.Name, request.InterpretationIndex);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
 /// <summary>Snippet for ExecuteQuestion</summary>
 public void ExecuteQuestionRequestObject()
 {
     // Snippet: ExecuteQuestion(ExecuteQuestionRequest, CallSettings)
     // Create client
     QuestionServiceClient questionServiceClient = QuestionServiceClient.Create();
     // Initialize request argument(s)
     ExecuteQuestionRequest request = new ExecuteQuestionRequest
     {
         Name = "",
         InterpretationIndex = 0,
     };
     // Make the request
     Question response = questionServiceClient.ExecuteQuestion(request);
     // End snippet
 }
コード例 #3
0
        /// <summary>Snippet for ExecuteQuestionAsync</summary>
        public async Task ExecuteQuestionRequestObjectAsync()
        {
            // Snippet: ExecuteQuestionAsync(ExecuteQuestionRequest, CallSettings)
            // Additional: ExecuteQuestionAsync(ExecuteQuestionRequest, CancellationToken)
            // Create client
            QuestionServiceClient questionServiceClient = await QuestionServiceClient.CreateAsync();

            // Initialize request argument(s)
            ExecuteQuestionRequest request = new ExecuteQuestionRequest
            {
                Name = "",
                InterpretationIndex = 0,
            };
            // Make the request
            Question response = await questionServiceClient.ExecuteQuestionAsync(request);

            // End snippet
        }