Example #1
0
        public async stt::Task GetLanguageConstantRequestObjectAsync()
        {
            moq::Mock <LanguageConstantService.LanguageConstantServiceClient> mockGrpcClient = new moq::Mock <LanguageConstantService.LanguageConstantServiceClient>(moq::MockBehavior.Strict);
            GetLanguageConstantRequest request = new GetLanguageConstantRequest
            {
                ResourceNameAsLanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
            };
            gagvr::LanguageConstant expectedResponse = new gagvr::LanguageConstant
            {
                ResourceNameAsLanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
                Id   = -6774108720365892680L,
                Code = "code946733c1",
                LanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
                Targetable           = true,
            };

            mockGrpcClient.Setup(x => x.GetLanguageConstantAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::LanguageConstant>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            LanguageConstantServiceClient client = new LanguageConstantServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::LanguageConstant       responseCallSettings = await client.GetLanguageConstantAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            gagvr::LanguageConstant responseCancellationToken = await client.GetLanguageConstantAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
 /// <summary>Snippet for GetLanguageConstant</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetLanguageConstantRequestObject()
 {
     // Create client
     LanguageConstantServiceClient languageConstantServiceClient = LanguageConstantServiceClient.Create();
     // Initialize request argument(s)
     GetLanguageConstantRequest request = new GetLanguageConstantRequest
     {
         ResourceNameAsLanguageConstantName = LanguageConstantName.FromCriterion("[CRITERION_ID]"),
     };
     // Make the request
     LanguageConstant response = languageConstantServiceClient.GetLanguageConstant(request);
 }
Example #3
0
 /// <summary>Snippet for GetLanguageConstant</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetLanguageConstantRequestObject()
 {
     // Create client
     LanguageConstantServiceClient languageConstantServiceClient = LanguageConstantServiceClient.Create();
     // Initialize request argument(s)
     GetLanguageConstantRequest request = new GetLanguageConstantRequest
     {
         ResourceNameAsLanguageConstantName = LanguageConstantName.FromLanguageConstant("[LANGUAGE_CONSTANT]"),
     };
     // Make the request
     LanguageConstant response = languageConstantServiceClient.GetLanguageConstant(request);
 }
Example #4
0
        /// <summary>Snippet for GetLanguageConstantAsync</summary>
        public async Task GetLanguageConstantRequestObjectAsync()
        {
            // Snippet: GetLanguageConstantAsync(GetLanguageConstantRequest, CallSettings)
            // Additional: GetLanguageConstantAsync(GetLanguageConstantRequest, CancellationToken)
            // Create client
            LanguageConstantServiceClient languageConstantServiceClient = await LanguageConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetLanguageConstantRequest request = new GetLanguageConstantRequest
            {
                ResourceNameAsLanguageConstantName = LanguageConstantName.FromCriterion("[CRITERION_ID]"),
            };
            // Make the request
            LanguageConstant response = await languageConstantServiceClient.GetLanguageConstantAsync(request);

            // End snippet
        }
        public void GetLanguageConstant2()
        {
            Mock <LanguageConstantService.LanguageConstantServiceClient> mockGrpcClient = new Mock <LanguageConstantService.LanguageConstantServiceClient>(MockBehavior.Strict);
            GetLanguageConstantRequest request = new GetLanguageConstantRequest
            {
                ResourceName = new LanguageConstantName("[LANGUAGE_CONSTANT]").ToString(),
            };
            LanguageConstant expectedResponse = new LanguageConstant
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetLanguageConstant(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            LanguageConstantServiceClient client = new LanguageConstantServiceClientImpl(mockGrpcClient.Object, null);
            LanguageConstant response            = client.GetLanguageConstant(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetLanguageConstantAsync2()
        {
            Mock <LanguageConstantService.LanguageConstantServiceClient> mockGrpcClient = new Mock <LanguageConstantService.LanguageConstantServiceClient>(MockBehavior.Strict);
            GetLanguageConstantRequest request = new GetLanguageConstantRequest
            {
                ResourceName = new LanguageConstantName("[LANGUAGE_CONSTANT]").ToString(),
            };
            LanguageConstant expectedResponse = new LanguageConstant
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetLanguageConstantAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <LanguageConstant>(Task.FromResult(expectedResponse), null, null, null, null));
            LanguageConstantServiceClient client = new LanguageConstantServiceClientImpl(mockGrpcClient.Object, null);
            LanguageConstant response            = await client.GetLanguageConstantAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #7
0
        public void GetLanguageConstant()
        {
            moq::Mock <LanguageConstantService.LanguageConstantServiceClient> mockGrpcClient = new moq::Mock <LanguageConstantService.LanguageConstantServiceClient>(moq::MockBehavior.Strict);
            GetLanguageConstantRequest request = new GetLanguageConstantRequest
            {
                ResourceNameAsLanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
            };
            gagvr::LanguageConstant expectedResponse = new gagvr::LanguageConstant
            {
                ResourceNameAsLanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
                Id   = -6774108720365892680L,
                Code = "code946733c1",
                LanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
                Targetable           = true,
            };

            mockGrpcClient.Setup(x => x.GetLanguageConstant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            LanguageConstantServiceClient client   = new LanguageConstantServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::LanguageConstant       response = client.GetLanguageConstant(request.ResourceName);

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