public void ListProjects() { var projectId = "project"; var service = new FakeBigqueryService(); var client = new BigqueryClientImpl(projectId, service); var reference = client.GetProjectReference(projectId); service.ExpectRequest( service.Projects.List(), new ProjectList { Projects = new[] { new ProjectsData { ProjectReference = reference } } }); var result = client.ListProjects(); var dataset = result.Single(); Assert.Equal(projectId, dataset.Reference.ProjectId); }
public async Task ListJobsAsync() { var projectId = "project"; var jobId = "job"; var service = new FakeBigqueryService(); var client = new BigqueryClientImpl(projectId, service); var projectReference = client.GetProjectReference(projectId); var jobReference = client.GetJobReference(projectId, jobId); service.ExpectRequest( service.Jobs.List(projectId), new JobList { Jobs = new[] { new JobsData { JobReference = jobReference } } }); var result = client.ListJobsAsync(projectReference); var job = await result.Single(); Assert.Equal(projectId, job.Reference.ProjectId); Assert.Equal(jobId, job.Reference.JobId); }
public async Task ListDatasetsAsync() { 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.ListDatasetsAsync(projectReference); var dataset = await result.Single(); Assert.Equal(projectId, dataset.Reference.ProjectId); Assert.Equal(datasetId, dataset.Reference.DatasetId); }