Example #1
0
        public async stt::Task ListAsync()
        {
            moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict);
            ListSslCertificatesRequest request = new ListSslCertificatesRequest
            {
                Project = "projectaa6ff846",
            };
            SslCertificateList expectedResponse = new SslCertificateList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new SslCertificate(),
                },
                SelfLink = "self_link7e87f12d",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
        public void ListRequestObject()
        {
            moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict);
            ListSslCertificatesRequest request = new ListSslCertificatesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                Filter               = "filtere47ac9b2",
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                ReturnPartialSuccess = false,
            };
            SslCertificateList expectedResponse = new SslCertificateList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new SslCertificate(),
                },
                SelfLink = "self_link7e87f12d",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #3
0
        public void List()
        {
            moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict);
            ListSslCertificatesRequest request = new ListSslCertificatesRequest
            {
                Project = "projectaa6ff846",
            };
            SslCertificateList expectedResponse = new SslCertificateList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new SslCertificate(),
                },
                SelfLink = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SslCertificatesClient client   = new SslCertificatesClientImpl(mockGrpcClient.Object, null);
            SslCertificateList    response = client.List(request.Project);

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

            // Initialize request argument(s)
            ListSslCertificatesRequest request = new ListSslCertificatesRequest
            {
                OrderBy = "",
                Project = "",
                Filter  = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedAsyncEnumerable <SslCertificateList, SslCertificate> response = sslCertificatesClient.ListAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((SslCertificate 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((SslCertificateList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (SslCertificate 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 <SslCertificate> 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 (SslCertificate 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(ListSslCertificatesRequest, CallSettings)
     // Create client
     SslCertificatesClient sslCertificatesClient = SslCertificatesClient.Create();
     // Initialize request argument(s)
     ListSslCertificatesRequest request = new ListSslCertificatesRequest
     {
         PageToken            = "",
         MaxResults           = 0U,
         Filter               = "",
         OrderBy              = "",
         Project              = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     SslCertificateList response = sslCertificatesClient.List(request);
     // End snippet
 }
Example #6
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListSslCertificatesRequest, CallSettings)
            // Additional: ListAsync(ListSslCertificatesRequest, CancellationToken)
            // Create client
            SslCertificatesClient sslCertificatesClient = await SslCertificatesClient.CreateAsync();

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

            // End snippet
        }
Example #7
0
 /// <summary>
 /// Retrieves the list of SslCertificate resources 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 <SslCertificateList> ListAsync(ListSslCertificatesRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListSslCertificatesRequest(ref request, ref callSettings);
     return(_callList.Async(request, callSettings));
 }
Example #8
0
 partial void Modify_ListSslCertificatesRequest(ref ListSslCertificatesRequest request, ref gaxgrpc::CallSettings settings);
Example #9
0
 /// <summary>
 /// Retrieves the list of SslCertificate resources 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 <SslCertificateList> ListAsync(ListSslCertificatesRequest request, st::CancellationToken cancellationToken) =>
 ListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
Example #10
0
 /// <summary>
 /// Retrieves the list of SslCertificate resources 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 <SslCertificateList> ListAsync(ListSslCertificatesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Example #11
0
 /// <summary>
 /// Retrieves the list of SslCertificate resources 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="SslCertificate"/> resources.</returns>
 public override gax::PagedAsyncEnumerable <SslCertificateList, SslCertificate> ListAsync(ListSslCertificatesRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListSslCertificatesRequest(ref request, ref callSettings);
     return(new gaxgrpc::GrpcPagedAsyncEnumerable <ListSslCertificatesRequest, SslCertificateList, SslCertificate>(_callList, request, callSettings));
 }
Example #12
0
 /// <summary>
 /// Retrieves the list of SslCertificate resources 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="SslCertificate"/> resources.</returns>
 public virtual gax::PagedAsyncEnumerable <SslCertificateList, SslCertificate> ListAsync(ListSslCertificatesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();