public void InsertRow() { var client = BigQueryClient.Create(_fixture.ProjectId); var dataset = client.GetDataset(_fixture.DatasetId); var table = dataset.GetTable(_fixture.HighScoreTableId); var row = BuildRow("Joe", 100, new DateTime(2016, 4, 26, 11, 43, 1, DateTimeKind.Utc)); _fixture.InsertAndWait(table, () => table.InsertRow(row), 1); var rowsAfter = table.ListRows(); var fetched = rowsAfter.Single(r => (string)r["player"] == "Joe"); Assert.Equal(row["score"], fetched["score"]); Assert.Equal(row["gameStarted"], fetched["gameStarted"]); }
public void ComplexTypes() { var client = BigQueryClient.Create(_fixture.ProjectId); var dataset = client.GetDataset(_fixture.DatasetId); var table = dataset.GetTable(_fixture.ComplexTypesTableId); var guid = Guid.NewGuid().ToString(); var insertRow = new BigQueryInsertRow { ["guid"] = guid, ["tags"] = new[] { "a", "b" }, ["position"] = new BigQueryInsertRow { ["x"] = 10L, ["y"] = 20L }, ["names"] = new[] { new BigQueryInsertRow { ["first"] = "a", ["last"] = "b" }, new BigQueryInsertRow { ["first"] = "x", ["last"] = "y" } } }; _fixture.InsertAndWait(table, () => table.InsertRow(insertRow), 1); var result = table.ListRows(); var row = result.Single(r => (string)r["guid"] == guid); var tags = (string[])row["tags"]; Assert.Equal(new[] { "a", "b" }, tags); var position = (Dictionary <string, object>)row["position"]; Assert.Equal(new Dictionary <string, object> { ["x"] = 10L, ["y"] = 20L }, position); var names = (Dictionary <string, object>[])row["names"]; Assert.Equal(new[] { new Dictionary <string, object> { ["first"] = "a", ["last"] = "b" }, new Dictionary <string, object> { ["first"] = "x", ["last"] = "y" } }, names); }