public async stt::Task ListAsync()
        {
            moq::Mock <DiskTypes.DiskTypesClient> mockGrpcClient = new moq::Mock <DiskTypes.DiskTypesClient>(moq::MockBehavior.Strict);
            ListDiskTypesRequest request = new ListDiskTypesRequest
            {
                Zone    = "zone255f4ea8",
                Project = "projectaa6ff846",
            };
            DiskTypeList expectedResponse = new DiskTypeList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new DiskType(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <DiskTypeList>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            DiskTypesClient client = new DiskTypesClientImpl(mockGrpcClient.Object, null);
            DiskTypeList    responseCallSettings = await client.ListAsync(request.Project, request.Zone, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            DiskTypeList responseCancellationToken = await client.ListAsync(request.Project, request.Zone, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void List()
        {
            moq::Mock <DiskTypes.DiskTypesClient> mockGrpcClient = new moq::Mock <DiskTypes.DiskTypesClient>(moq::MockBehavior.Strict);
            ListDiskTypesRequest request = new ListDiskTypesRequest
            {
                Zone    = "zone255f4ea8",
                Project = "projectaa6ff846",
            };
            DiskTypeList expectedResponse = new DiskTypeList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new DiskType(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            DiskTypesClient client   = new DiskTypesClientImpl(mockGrpcClient.Object, null);
            DiskTypeList    response = client.List(request.Project, request.Zone);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void ListRequestObject()
        {
            moq::Mock <DiskTypes.DiskTypesClient> mockGrpcClient = new moq::Mock <DiskTypes.DiskTypesClient>(moq::MockBehavior.Strict);
            ListDiskTypesRequest request = new ListDiskTypesRequest
            {
                Zone                 = "zone255f4ea8",
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                ReturnPartialSuccess = false,
            };
            DiskTypeList expectedResponse = new DiskTypeList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new DiskType(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            DiskTypesClient client   = new DiskTypesClientImpl(mockGrpcClient.Object, null);
            DiskTypeList    response = client.List(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListDiskTypesRequest, CallSettings)
            // Create client
            DiskTypesClient diskTypesClient = await DiskTypesClient.CreateAsync();

            // Initialize request argument(s)
            ListDiskTypesRequest request = new ListDiskTypesRequest
            {
                Zone    = "",
                OrderBy = "",
                Project = "",
                Filter  = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedAsyncEnumerable <DiskTypeList, DiskType> response = diskTypesClient.ListAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((DiskType item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((DiskTypeList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (DiskType item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int             pageSize   = 10;
            Page <DiskType> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (DiskType item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Example #5
0
 /// <summary>Snippet for List</summary>
 public void ListRequestObject()
 {
     // Snippet: List(ListDiskTypesRequest, CallSettings)
     // Create client
     DiskTypesClient diskTypesClient = DiskTypesClient.Create();
     // Initialize request argument(s)
     ListDiskTypesRequest request = new ListDiskTypesRequest
     {
         Zone                 = "",
         PageToken            = "",
         MaxResults           = 0U,
         OrderBy              = "",
         Project              = "",
         Filter               = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     DiskTypeList response = diskTypesClient.List(request);
     // End snippet
 }
Example #6
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListDiskTypesRequest, CallSettings)
            // Additional: ListAsync(ListDiskTypesRequest, CancellationToken)
            // Create client
            DiskTypesClient diskTypesClient = await DiskTypesClient.CreateAsync();

            // Initialize request argument(s)
            ListDiskTypesRequest request = new ListDiskTypesRequest
            {
                Zone                 = "",
                PageToken            = "",
                MaxResults           = 0U,
                OrderBy              = "",
                Project              = "",
                Filter               = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            DiskTypeList response = await diskTypesClient.ListAsync(request);

            // End snippet
        }
 /// <summary>
 /// Retrieves a list of disk types available to the specified project.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="DiskType"/> resources.</returns>
 public override gax::PagedAsyncEnumerable <DiskTypeList, DiskType> ListAsync(ListDiskTypesRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListDiskTypesRequest(ref request, ref callSettings);
     return(new gaxgrpc::GrpcPagedAsyncEnumerable <ListDiskTypesRequest, DiskTypeList, DiskType>(_callList, request, callSettings));
 }
 partial void Modify_ListDiskTypesRequest(ref ListDiskTypesRequest request, ref gaxgrpc::CallSettings settings);
 /// <summary>
 /// Retrieves a list of disk types available to the specified project.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="DiskType"/> resources.</returns>
 public virtual gax::PagedAsyncEnumerable <DiskTypeList, DiskType> ListAsync(ListDiskTypesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
 /// <summary>
 /// Retrieves a list of disk types available to the specified project.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public override stt::Task <DiskTypeList> ListAsync(ListDiskTypesRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListDiskTypesRequest(ref request, ref callSettings);
     return(_callList.Async(request, callSettings));
 }
 /// <summary>
 /// Retrieves a list of disk types available to the specified project.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public override DiskTypeList List(ListDiskTypesRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListDiskTypesRequest(ref request, ref callSettings);
     return(_callList.Sync(request, callSettings));
 }
 /// <summary>
 /// Retrieves a list of disk types available to the specified project.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <DiskTypeList> ListAsync(ListDiskTypesRequest request, st::CancellationToken cancellationToken) =>
 ListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 /// <summary>
 /// Retrieves a list of disk types available to the specified project.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <DiskTypeList> ListAsync(ListDiskTypesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
 /// <summary>
 /// Retrieves a list of disk types available to the specified project.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public virtual DiskTypeList List(ListDiskTypesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();