public async void ShouldListActionstepParticipants() { using (var authDelegatingHandler = new AuthDelegatingHandler() { InnerHandler = _handler }) using (var httpClient = new HttpClient(authDelegatingHandler)) using (var memoryCache = new MemoryCache(new MemoryCacheOptions())) { var fakeClock = new FakeClock(Instant.FromUtc(2019, 05, 07, 2, 3)); var testTokenRepository = new TestTokenSetRepository(); var testTokenSet = GetTestTokenSet(); await testTokenRepository.AddOrUpdateTokenSet(testTokenSet); var options = new ActionstepServiceConfigurationOptions("clientId", "clientSecret"); var actionstepService = new ActionstepService(new NullLogger <ActionstepService>(), httpClient, options, testTokenRepository, fakeClock, memoryCache); var request = new ListParticipantsRequest { TokenSetQuery = new TokenSetQuery(testTokenSet.UserId, testTokenSet.OrgKey) }; var response = await actionstepService.Handle <ListParticipantsResponse>(request); var admin = response.Participants.SingleOrDefault(p => p.Id == 1); Assert.NotNull(admin); var expectedBirthTimestamp = new LocalDate(2000, 1, 1); var expectedDeathTimestamp = new LocalDate(2001, 1, 1); Assert.Equal(expectedBirthTimestamp, admin.BirthTimestamp); Assert.Equal(expectedDeathTimestamp, admin.DeathTimestamp); } }
/// <summary>Snippet for ListParticipants</summary> public async Task ListParticipantsRequestObjectAsync() { // Snippet: ListParticipantsAsync(ListParticipantsRequest, CallSettings) // Create client ParticipantsClient participantsClient = await ParticipantsClient.CreateAsync(); // Initialize request argument(s) ListParticipantsRequest request = new ListParticipantsRequest { ParentAsConversationName = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"), }; // Make the request PagedAsyncEnumerable <ListParticipantsResponse, Participant> response = participantsClient.ListParticipantsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Participant 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((ListParticipantsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Participant 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 <Participant> 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 (Participant 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 }