Esempio n. 1
0
        public void CreateQuestionResourceNames()
        {
            moq::Mock <QuestionService.QuestionServiceClient> mockGrpcClient = new moq::Mock <QuestionService.QuestionServiceClient>(moq::MockBehavior.Strict);
            CreateQuestionRequest request = new CreateQuestionRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Question             = new Question(),
            };
            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.CreateQuestion(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            QuestionServiceClient client = new QuestionServiceClientImpl(mockGrpcClient.Object, null);
            Question response            = client.CreateQuestion(request.ParentAsLocationName, request.Question);

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