예제 #1
0
        public void ModifyRequest_ForceNoPreconditions_ButPreconditionsSet()
        {
            var bucket = new Bucket {
                Metageneration = 10L
            };
            var request = new UpdateRequest(null, bucket, "bucket");
            var options = new UpdateBucketOptions {
                ForceNoPreconditions = true, IfMetagenerationMatch = 2L
            };

            Assert.Throws <ArgumentException>(() => options.ModifyRequest(request, bucket));
        }
예제 #2
0
        public void ModifyRequest_MatchNotMatchConflicts()
        {
            var bucket = new Bucket {
                Metageneration = 10L
            };
            var request = new UpdateRequest(null, bucket, "bucket");

            Assert.Throws <ArgumentException>(() =>
            {
                var options = new UpdateBucketOptions {
                    IfMetagenerationMatch = 1L, IfMetagenerationNotMatch = 2L
                };
                options.ModifyRequest(request, bucket);
            });
        }
        public void ModifyRequest_DefaultOptions()
        {
            var bucket = new Bucket {
                Metageneration = 10L
            };
            var request = new UpdateRequest(null, bucket, "bucket");
            var options = new UpdateBucketOptions();

            options.ModifyRequest(request, bucket);
            Assert.Equal(10L, request.IfMetagenerationMatch);
            Assert.Null(request.IfMetagenerationNotMatch);
            Assert.Null(request.PredefinedAcl);
            Assert.Null(request.PredefinedDefaultObjectAcl);
            Assert.Null(request.Projection);
        }
예제 #4
0
        public void ModifyRequest_NegativeMatchOptions()
        {
            var bucket = new Bucket {
                Metageneration = 10L
            };
            var request = new UpdateRequest(null, bucket, "bucket");
            var options = new UpdateBucketOptions
            {
                IfMetagenerationNotMatch   = 1L,
                PredefinedAcl              = PredefinedBucketAcl.AuthenticatedRead,
                PredefinedDefaultObjectAcl = PredefinedObjectAcl.BucketOwnerFullControl,
                Projection = Projection.Full
            };

            options.ModifyRequest(request, bucket);
            Assert.Null(request.IfMetagenerationMatch);
            Assert.Equal(1L, request.IfMetagenerationNotMatch);
            Assert.Equal(PredefinedAclEnum.AuthenticatedRead, request.PredefinedAcl);
            Assert.Equal(PredefinedDefaultObjectAclEnum.BucketOwnerFullControl, request.PredefinedDefaultObjectAcl);
            Assert.Equal(ProjectionEnum.Full, request.Projection);
        }