Exemplo n.º 1
0
        public void AggregatedList()
        {
            moq::Mock <Addresses.AddressesClient> mockGrpcClient = new moq::Mock <Addresses.AddressesClient>(moq::MockBehavior.Strict);
            AggregatedListAddressesRequest        request        = new AggregatedListAddressesRequest
            {
                Project = "projectaa6ff846",
            };
            AddressAggregatedList expectedResponse = new AddressAggregatedList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    {
                        "key8a0b6e3c",
                        new AddressesScopedList()
                    },
                },
                Unreachables =
                {
                    "unreachables3ca950ee",
                },
                SelfLink = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.AggregatedList(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AddressesClient       client   = new AddressesClientImpl(mockGrpcClient.Object, null);
            AddressAggregatedList response = client.AggregatedList(request.Project);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
 /// <summary>Snippet for AggregatedList</summary>
 public void AggregatedList()
 {
     // Snippet: AggregatedList(string, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     string project = "";
     // Make the request
     AddressAggregatedList response = addressesClient.AggregatedList(project);
     // End snippet
 }
Exemplo n.º 3
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListAsync()
        {
            // Snippet: AggregatedListAsync(string, CallSettings)
            // Additional: AggregatedListAsync(string, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            // Make the request
            AddressAggregatedList response = await addressesClient.AggregatedListAsync(project);

            // End snippet
        }
Exemplo n.º 4
0
 private IEnumerable <Address> GetProjectAddresses()
 {
     AddressesResource.AggregatedListRequest request = Service.Addresses.AggregatedList(Project);
     do
     {
         AddressAggregatedList response = request.Execute();
         if (response.Items != null)
         {
             IEnumerable <AddressesScopedList> populated =
                 response.Items.Values.Where(sl => sl.Addresses != null);
             foreach (Address address in populated.SelectMany(sl => sl.Addresses))
             {
                 yield return(address);
             }
         }
         request.PageToken = response.NextPageToken;
     } while (!Stopping && request.PageToken != null);
 }
Exemplo n.º 5
0
        public async stt::Task AggregatedListRequestObjectAsync()
        {
            moq::Mock <Addresses.AddressesClient> mockGrpcClient = new moq::Mock <Addresses.AddressesClient>(moq::MockBehavior.Strict);
            AggregatedListAddressesRequest        request        = new AggregatedListAddressesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                IncludeAllScopes     = false,
                ReturnPartialSuccess = false,
            };
            AddressAggregatedList expectedResponse = new AddressAggregatedList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    {
                        "key8a0b6e3c",
                        new AddressesScopedList()
                    },
                },
                Unreachables =
                {
                    "unreachables3ca950ee",
                },
                SelfLink = "self_link7e87f12d",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 6
0
 /// <summary>Snippet for AggregatedList</summary>
 public void AggregatedListRequestObject()
 {
     // Snippet: AggregatedList(AggregatedListAddressesRequest, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     AggregatedListAddressesRequest request = new AggregatedListAddressesRequest
     {
         PageToken            = "",
         MaxResults           = 0U,
         Filter               = "",
         IncludeAllScopes     = false,
         OrderBy              = "",
         Project              = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     AddressAggregatedList response = addressesClient.AggregatedList(request);
     // End snippet
 }
Exemplo n.º 7
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListRequestObjectAsync()
        {
            // Snippet: AggregatedListAsync(AggregatedListAddressesRequest, CallSettings)
            // Additional: AggregatedListAsync(AggregatedListAddressesRequest, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            AggregatedListAddressesRequest request = new AggregatedListAddressesRequest
            {
                PageToken            = "",
                MaxResults           = 0U,
                Filter               = "",
                IncludeAllScopes     = false,
                OrderBy              = "",
                Project              = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            AddressAggregatedList response = await addressesClient.AggregatedListAsync(request);

            // End snippet
        }