示例#1
0
        public void ModifyRequest_NoOp()
        {
            var request = new GetRequest(null, "project", "dataset");
            var options = new GetDatasetOptions();

            options.ModifyRequest(request);
        }
        public async Task GetDatasetAsync_CorrectETag()
        {
            var client = BigQueryClient.Create(_fixture.ProjectId);
            // Fetch without specifying an ETag first
            var unconditional = await client.GetDatasetAsync(_fixture.DatasetId);

            var options = new GetDatasetOptions { ETag = unconditional.Resource.ETag };
            await client.GetDatasetAsync(_fixture.DatasetId, options);
        }
        public async Task GetDatasetAsync_IncorrectETag()
        {
            var client = BigQueryClient.Create(_fixture.ProjectId);
            // Fetch without specifying an ETag first
            var unconditional = await client.GetDatasetAsync(_fixture.DatasetId);

            var options = new GetDatasetOptions { ETag = "wrong-" + unconditional.Resource.ETag };
            var exception = await Assert.ThrowsAsync<GoogleApiException>(() => client.GetDatasetAsync(_fixture.DatasetId, options));
            Assert.Equal(HttpStatusCode.PreconditionFailed, exception.HttpStatusCode);
        }
示例#4
0
        public void GetDatasetEquivalents()
        {
            var datasetId = "dataset";
            var reference = GetDatasetReference(datasetId);
            var options   = new GetDatasetOptions();

            VerifyEquivalent(new BigQueryDataset(new DerivedBigQueryClient(), GetDataset(reference)),
                             client => client.GetDataset(MatchesWhenSerialized(reference), options),
                             client => client.GetDataset(datasetId, options),
                             client => client.GetDataset(ProjectId, datasetId, options));
        }
示例#5
0
        public void GetDatasetAsyncEquivalents()
        {
            var datasetId = "dataset";
            var reference = GetDatasetReference(datasetId);
            var options   = new GetDatasetOptions();
            var token     = new CancellationTokenSource().Token;

            VerifyEquivalentAsync(new BigQueryDataset(new DerivedBigQueryClient(), GetDataset(reference)),
                                  client => client.GetDatasetAsync(MatchesWhenSerialized(reference), options, token),
                                  client => client.GetDatasetAsync(datasetId, options, token),
                                  client => client.GetDatasetAsync(ProjectId, datasetId, options, token));
        }