Beispiel #1
0
        public async stt::Task BatchGetServicesRequestObjectAsync()
        {
            moq::Mock <ServiceUsage.ServiceUsageClient> mockGrpcClient = new moq::Mock <ServiceUsage.ServiceUsageClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            BatchGetServicesRequest request = new BatchGetServicesRequest
            {
                Parent = "parent7858e4d0",
                Names  = { "names318c99a8", },
            };
            BatchGetServicesResponse expectedResponse = new BatchGetServicesResponse
            {
                Services = { new Service(), },
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
 /// <summary>Snippet for BatchGetServices</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void BatchGetServicesRequestObject()
 {
     // Create client
     ServiceUsageClient serviceUsageClient = ServiceUsageClient.Create();
     // Initialize request argument(s)
     BatchGetServicesRequest request = new BatchGetServicesRequest
     {
         Parent = "",
         Names  = { "", },
     };
     // Make the request
     BatchGetServicesResponse response = serviceUsageClient.BatchGetServices(request);
 }
        /// <summary>Snippet for BatchGetServicesAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task BatchGetServicesRequestObjectAsync()
        {
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            BatchGetServicesRequest request = new BatchGetServicesRequest
            {
                Parent = "",
                Names  = { "", },
            };
            // Make the request
            BatchGetServicesResponse response = await serviceUsageClient.BatchGetServicesAsync(request);
        }
        /// <summary>Snippet for BatchGetServicesAsync</summary>
        public async Task BatchGetServicesRequestObjectAsync()
        {
            // Snippet: BatchGetServicesAsync(BatchGetServicesRequest, CallSettings)
            // Additional: BatchGetServicesAsync(BatchGetServicesRequest, CancellationToken)
            // Create client
            ServiceUsageClient serviceUsageClient = await ServiceUsageClient.CreateAsync();

            // Initialize request argument(s)
            BatchGetServicesRequest request = new BatchGetServicesRequest
            {
                Parent = "",
                Names  = { "", },
            };
            // Make the request
            BatchGetServicesResponse response = await serviceUsageClient.BatchGetServicesAsync(request);

            // End snippet
        }
Beispiel #5
0
        public void BatchGetServicesRequestObject()
        {
            moq::Mock <ServiceUsage.ServiceUsageClient> mockGrpcClient = new moq::Mock <ServiceUsage.ServiceUsageClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            BatchGetServicesRequest request = new BatchGetServicesRequest
            {
                Parent = "parent7858e4d0",
                Names  = { "names318c99a8", },
            };
            BatchGetServicesResponse expectedResponse = new BatchGetServicesResponse
            {
                Services = { new Service(), },
            };

            mockGrpcClient.Setup(x => x.BatchGetServices(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ServiceUsageClient       client   = new ServiceUsageClientImpl(mockGrpcClient.Object, null);
            BatchGetServicesResponse response = client.BatchGetServices(request);

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