示例#1
0
        public async Task ListRowsAsync()
        {
            string projectId = _fixture.ProjectId;
            string datasetId = _fixture.GameDatasetId;
            string tableId   = _fixture.HistoryTableId;

            // Snippet: ListRowsAsync
            BigQueryClient client = BigQueryClient.Create(projectId);
            BigQueryTable  table  = client.GetTable(datasetId, tableId);
            PagedAsyncEnumerable <TableDataList, BigQueryRow> result = table.ListRowsAsync();
            await result.ForEachAsync(row =>
            {
                DateTime timestamp = (DateTime)row["game_started"];
                long level         = (long)row["level"];
                long score         = (long)row["score"];
                string player      = (string)row["player"];
                Console.WriteLine($"{player}: {level}/{score} ({timestamp:yyyy-MM-dd HH:mm:ss})");
            });

            // End snippet

            // We set up 7 results in the fixture. Other tests may add more.
            Assert.True(await result.CountAsync() >= 7);
        }