Example #1
0
        public async Task DeleteDatasetAsync()
        {
            var projectId = "project";
            var datasetId = "dataset";
            var service   = new FakeBigqueryService();
            var client    = new BigqueryClientImpl(projectId, service);
            var reference = client.GetDatasetReference(projectId, datasetId);

            service.ExpectRequest(
                service.Datasets.Delete(projectId, datasetId),
                "OK");
            await client.DeleteDatasetAsync(reference);
        }
Example #2
0
        public void GetDataset()
        {
            var projectId = "project";
            var datasetId = "dataset";
            var service   = new FakeBigqueryService();
            var client    = new BigqueryClientImpl(projectId, service);
            var reference = client.GetDatasetReference(projectId, datasetId);

            service.ExpectRequest(
                service.Datasets.Get(projectId, datasetId),
                new Dataset {
                DatasetReference = reference
            });
            var result = client.GetDataset(reference);

            Assert.Equal(projectId, result.Reference.ProjectId);
            Assert.Equal(datasetId, result.Reference.DatasetId);
        }
Example #3
0
        public async Task CreateDatasetAsync()
        {
            var projectId = "project";
            var datasetId = "dataset";
            var service   = new FakeBigqueryService();
            var client    = new BigqueryClientImpl(projectId, service);
            var reference = client.GetDatasetReference(projectId, datasetId);

            service.ExpectRequest(
                service.Datasets.Insert(new Dataset {
                DatasetReference = reference
            }, projectId),
                new Dataset {
                DatasetReference = reference
            });
            var result = await client.CreateDatasetAsync(reference);

            Assert.Equal(projectId, result.Reference.ProjectId);
            Assert.Equal(datasetId, result.Reference.DatasetId);
        }
Example #4
0
        public void ListDatasets()
        {
            var projectId        = "project";
            var datasetId        = "dataset";
            var service          = new FakeBigqueryService();
            var client           = new BigqueryClientImpl(projectId, service);
            var projectReference = client.GetProjectReference(projectId);
            var datasetReference = client.GetDatasetReference(projectId, datasetId);

            service.ExpectRequest(
                service.Datasets.List(projectId),
                new DatasetList {
                Datasets = new[] { new DatasetsData {
                                       DatasetReference = datasetReference
                                   } }
            });
            var result  = client.ListDatasets(projectReference);
            var dataset = result.Single();

            Assert.Equal(projectId, dataset.Reference.ProjectId);
            Assert.Equal(datasetId, dataset.Reference.DatasetId);
        }