Beispiel #1
0
        public void ModifyRequest_DefaultOptions()
        {
            var request = new DeleteRequest(null, "bucket", "object");
            var options = new DeleteObjectOptions();

            options.ModifyRequest(request);
            Assert.Null(request.Generation);
            Assert.Null(request.IfGenerationMatch);
            Assert.Null(request.IfGenerationNotMatch);
            Assert.Null(request.IfMetagenerationMatch);
            Assert.Null(request.IfMetagenerationNotMatch);
        }
Beispiel #2
0
        public void ModifyRequest_NegativeMatchOptions()
        {
            var request = new DeleteRequest(null, "bucket", "object");
            var options = new DeleteObjectOptions
            {
                IfGenerationNotMatch     = 1L,
                IfMetagenerationNotMatch = 2L,
                Generation = 3L
            };

            options.ModifyRequest(request);
            Assert.Null(request.IfGenerationMatch);
            Assert.Equal(1L, request.IfGenerationNotMatch);
            Assert.Null(request.IfMetagenerationMatch);
            Assert.Equal(2L, request.IfMetagenerationNotMatch);
            Assert.Equal(3L, request.Generation);
        }
Beispiel #3
0
        public void ModifyRequest_MatchNotMatchConflicts()
        {
            var request = new DeleteRequest(null, "bucket", "object");

            Assert.Throws <ArgumentException>(() =>
            {
                var options = new DeleteObjectOptions {
                    IfGenerationMatch = 1L, IfGenerationNotMatch = 2L
                };
                options.ModifyRequest(request);
            });
            Assert.Throws <ArgumentException>(() =>
            {
                var options = new DeleteObjectOptions {
                    IfMetagenerationMatch = 1L, IfMetagenerationNotMatch = 2L
                };
                options.ModifyRequest(request);
            });
        }