public void AggregatedList() { moq::Mock <MachineTypes.MachineTypesClient> mockGrpcClient = new moq::Mock <MachineTypes.MachineTypesClient>(moq::MockBehavior.Strict); AggregatedListMachineTypesRequest request = new AggregatedListMachineTypesRequest { Project = "projectaa6ff846", }; MachineTypeAggregatedList expectedResponse = new MachineTypeAggregatedList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { { "key8a0b6e3c", new MachineTypesScopedList() }, }, SelfLink = "self_link7e87f12d", Unreachables = { "unreachables3ca950ee", }, }; mockGrpcClient.Setup(x => x.AggregatedList(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MachineTypesClient client = new MachineTypesClientImpl(mockGrpcClient.Object, null); MachineTypeAggregatedList response = client.AggregatedList(request.Project); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for AggregatedList</summary> public void AggregatedList() { // Snippet: AggregatedList(string, CallSettings) // Create client MachineTypesClient machineTypesClient = MachineTypesClient.Create(); // Initialize request argument(s) string project = ""; // Make the request MachineTypeAggregatedList response = machineTypesClient.AggregatedList(project); // End snippet }
/// <summary>Snippet for AggregatedListAsync</summary> public async Task AggregatedListAsync() { // Snippet: AggregatedListAsync(string, CallSettings) // Additional: AggregatedListAsync(string, CancellationToken) // Create client MachineTypesClient machineTypesClient = await MachineTypesClient.CreateAsync(); // Initialize request argument(s) string project = ""; // Make the request MachineTypeAggregatedList response = await machineTypesClient.AggregatedListAsync(project); // End snippet }
private IEnumerable <MachineType> GetAllProjectMachineTypes() { MachineTypesResource.AggregatedListRequest request = Service.MachineTypes.AggregatedList(Project); do { MachineTypeAggregatedList response = request.Execute(); if (response.Items != null) { Func <MachineTypesScopedList, IEnumerable <MachineType> > machineTypesOrEmpty = sl => sl.MachineTypes ?? Enumerable.Empty <MachineType>(); foreach (MachineType machineType in response.Items.Values.SelectMany(machineTypesOrEmpty)) { yield return(machineType); } } request.PageToken = response.NextPageToken; } while (request.PageToken != null && !Stopping); }
public async stt::Task AggregatedListRequestObjectAsync() { moq::Mock <MachineTypes.MachineTypesClient> mockGrpcClient = new moq::Mock <MachineTypes.MachineTypesClient>(moq::MockBehavior.Strict); AggregatedListMachineTypesRequest request = new AggregatedListMachineTypesRequest { PageToken = "page_tokenf09e5538", MaxResults = 2806814450U, Filter = "filtere47ac9b2", IncludeAllScopes = false, OrderBy = "order_byb4d33ada", Project = "projectaa6ff846", ReturnPartialSuccess = false, }; MachineTypeAggregatedList expectedResponse = new MachineTypeAggregatedList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { { "key8a0b6e3c", new MachineTypesScopedList() }, }, SelfLink = "self_link7e87f12d", Unreachables = { "unreachables3ca950ee", }, }; mockGrpcClient.Setup(x => x.AggregatedListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MachineTypeAggregatedList>(stt::Task.FromResult(expectedResponse), null, null, null, null)); MachineTypesClient client = new MachineTypesClientImpl(mockGrpcClient.Object, null); MachineTypeAggregatedList responseCallSettings = await client.AggregatedListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MachineTypeAggregatedList responseCancellationToken = await client.AggregatedListAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for AggregatedList</summary> public void AggregatedListRequestObject() { // Snippet: AggregatedList(AggregatedListMachineTypesRequest, CallSettings) // Create client MachineTypesClient machineTypesClient = MachineTypesClient.Create(); // Initialize request argument(s) AggregatedListMachineTypesRequest request = new AggregatedListMachineTypesRequest { PageToken = "", MaxResults = 0U, OrderBy = "", Project = "", Filter = "", IncludeAllScopes = false, ReturnPartialSuccess = false, }; // Make the request MachineTypeAggregatedList response = machineTypesClient.AggregatedList(request); // End snippet }
/// <summary>Snippet for AggregatedListAsync</summary> public async Task AggregatedListRequestObjectAsync() { // Snippet: AggregatedListAsync(AggregatedListMachineTypesRequest, CallSettings) // Additional: AggregatedListAsync(AggregatedListMachineTypesRequest, CancellationToken) // Create client MachineTypesClient machineTypesClient = await MachineTypesClient.CreateAsync(); // Initialize request argument(s) AggregatedListMachineTypesRequest request = new AggregatedListMachineTypesRequest { PageToken = "", MaxResults = 0U, OrderBy = "", Project = "", Filter = "", IncludeAllScopes = false, ReturnPartialSuccess = false, }; // Make the request MachineTypeAggregatedList response = await machineTypesClient.AggregatedListAsync(request); // End snippet }