public void ModifyRequest()
        {
            var options = new ListTablesOptions
            {
                PageSize = 25
            };
            ListRequest request = new ListRequest(new BigqueryService(), "project", "dataset");

            options.ModifyRequest(request);
            Assert.Equal(25, request.MaxResults);
        }
Example #2
0
        public void ListTablesEquivalents()
        {
            var datasetId = "dataset";
            var reference = GetDatasetReference(datasetId);
            var options   = new ListTablesOptions();

            VerifyEquivalent(new UnimplementedPagedEnumerable <TableList, BigQueryTable>(),
                             client => client.ListTables(MatchesWhenSerialized(reference), options),
                             client => client.ListTables(datasetId, options),
                             client => client.ListTables(ProjectId, datasetId, options),
                             client => new BigQueryDataset(client, GetDataset(datasetId)).ListTables(options));
        }
Example #3
0
        public void ListTablesAsyncEquivalents()
        {
            var datasetId = "dataset";
            var reference = GetDatasetReference(datasetId);
            var options   = new ListTablesOptions();
            var token     = new CancellationTokenSource().Token;

            VerifyEquivalent(new UnimplementedPagedAsyncEnumerable <TableList, BigQueryTable>(),
                             client => client.ListTablesAsync(MatchesWhenSerialized(reference), options),
                             client => client.ListTablesAsync(datasetId, options),
                             client => client.ListTablesAsync(ProjectId, datasetId, options),
                             client => new BigQueryDataset(client, GetDataset(datasetId)).ListTablesAsync(options));
        }
Example #4
0
        public void ListTables_ResumeWithPageToken()
        {
            var    client     = BigQueryClient.Create(_fixture.ProjectId);
            string datasetId  = _fixture.DatasetId;
            var    totalCount = client.ListTables(datasetId).Count();

            // We want to check that when reading the remained, we still need to paginate.
            // (If we had a bug that always used the original page token, we'd end up in an infinite loop.)
            Assert.True(totalCount > 4, "Must have more than 4 tables for pagination test");
            var firstPage = client.ListTables(datasetId).ReadPage(2);

            Assert.NotNull(firstPage.NextPageToken);

            var options = new ListTablesOptions {
                PageSize = 2, PageToken = firstPage.NextPageToken
            };
            var remainder = client.ListTables(datasetId, options).ToList();

            Assert.Equal(totalCount - 2, remainder.Count);
        }