public override Task <Bucket> GetBucketAsync( string bucket, GetBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { return(Task.Run(() => GetBucket(bucket, options))); }
public void ModifyRequest_DefaultOptions() { var request = new GetRequest(null, "bucket"); var options = new GetBucketOptions(); options.ModifyRequest(request); Assert.Null(request.IfMetagenerationMatch); Assert.Null(request.IfMetagenerationNotMatch); Assert.Null(request.Projection); }
public void ModifyRequest_MatchNotMatchConflicts() { var request = new GetRequest(null, "bucket"); Assert.Throws <ArgumentException>(() => { var options = new GetBucketOptions { IfMetagenerationMatch = 1L, IfMetagenerationNotMatch = 2L }; options.ModifyRequest(request); }); }
public void ModifyRequest_NegativeMatchOptions() { var request = new GetRequest(null, "bucket"); var options = new GetBucketOptions { IfMetagenerationNotMatch = 1L, Projection = Projection.Full }; options.ModifyRequest(request); Assert.Null(request.IfMetagenerationMatch); Assert.Equal(1L, request.IfMetagenerationNotMatch); Assert.Equal(ProjectionEnum.Full, request.Projection); }
// ************************************************************************************************************* // GET BUCKET public override Bucket GetBucket(string bucket, GetBucketOptions options = null) { lock (_syncBuckets) { if (!_buckets.Contains(bucket)) { // FIXME: Google compatible exception throw new InvalidOperationException($"No bucket found for {bucket}."); } } return(new Bucket { Name = bucket }); }