Esempio n. 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();
        }
 /// <summary>Snippet for GetQuestion</summary>
 public void GetQuestionResourceNames()
 {
     // Snippet: GetQuestion(QuestionName, CallSettings)
     // Create client
     QuestionServiceClient questionServiceClient = QuestionServiceClient.Create();
     // Initialize request argument(s)
     QuestionName name = QuestionName.FromProjectLocationQuestion("[PROJECT]", "[LOCATION]", "[QUESTION]");
     // Make the request
     Question response = questionServiceClient.GetQuestion(name);
     // End snippet
 }
        /// <summary>Snippet for GetQuestionAsync</summary>
        public async Task GetQuestionResourceNamesAsync()
        {
            // Snippet: GetQuestionAsync(QuestionName, CallSettings)
            // Additional: GetQuestionAsync(QuestionName, CancellationToken)
            // Create client
            QuestionServiceClient questionServiceClient = await QuestionServiceClient.CreateAsync();

            // Initialize request argument(s)
            QuestionName name = QuestionName.FromProjectLocationQuestion("[PROJECT]", "[LOCATION]", "[QUESTION]");
            // Make the request
            Question response = await questionServiceClient.GetQuestionAsync(name);

            // End snippet
        }
 /// <summary>Snippet for GetQuestion</summary>
 public void GetQuestionRequestObject()
 {
     // Snippet: GetQuestion(GetQuestionRequest, CallSettings)
     // Create client
     QuestionServiceClient questionServiceClient = QuestionServiceClient.Create();
     // Initialize request argument(s)
     GetQuestionRequest request = new GetQuestionRequest
     {
         QuestionName = QuestionName.FromProjectLocationQuestion("[PROJECT]", "[LOCATION]", "[QUESTION]"),
         ReadMask     = new FieldMask(),
     };
     // Make the request
     Question response = questionServiceClient.GetQuestion(request);
     // End snippet
 }
        /// <summary>Snippet for GetQuestionAsync</summary>
        public async Task GetQuestionRequestObjectAsync()
        {
            // Snippet: GetQuestionAsync(GetQuestionRequest, CallSettings)
            // Additional: GetQuestionAsync(GetQuestionRequest, CancellationToken)
            // Create client
            QuestionServiceClient questionServiceClient = await QuestionServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetQuestionRequest request = new GetQuestionRequest
            {
                QuestionName = QuestionName.FromProjectLocationQuestion("[PROJECT]", "[LOCATION]", "[QUESTION]"),
                ReadMask     = new FieldMask(),
            };
            // Make the request
            Question response = await questionServiceClient.GetQuestionAsync(request);

            // End snippet
        }
Esempio n. 6
0
        public async stt::Task GetQuestionRequestObjectAsync()
        {
            moq::Mock <QuestionService.QuestionServiceClient> mockGrpcClient = new moq::Mock <QuestionService.QuestionServiceClient>(moq::MockBehavior.Strict);
            GetQuestionRequest request = new GetQuestionRequest
            {
                QuestionName = QuestionName.FromProjectLocationQuestion("[PROJECT]", "[LOCATION]", "[QUESTION]"),
                ReadMask     = new wkt::FieldMask(),
            };
            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.GetQuestionAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Question>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            QuestionServiceClient client  = new QuestionServiceClientImpl(mockGrpcClient.Object, null);
            Question responseCallSettings = await client.GetQuestionAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }