public override Task <Object> PatchObjectAsync(
     Object obj,
     PatchObjectOptions options          = null,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Task.FromResult(obj));
 }
        public void ModifyRequest_DefaultOptions()
        {
            var request = new PatchRequest(null, null, "bucket", "object");
            var options = new PatchObjectOptions();

            options.ModifyRequest(request);
            Assert.Null(request.Generation);
            Assert.Null(request.IfGenerationMatch);
            Assert.Null(request.IfGenerationNotMatch);
            Assert.Null(request.IfMetagenerationMatch);
            Assert.Null(request.IfMetagenerationNotMatch);
            Assert.Null(request.PredefinedAcl);
            Assert.Null(request.Projection);
        }
Example #3
0
        public void ModifyRequest_MatchNotMatchConflicts()
        {
            var request = new PatchRequest(null, null, "bucket", "object");

            Assert.Throws <ArgumentException>(() =>
            {
                var options = new PatchObjectOptions {
                    IfGenerationMatch = 1L, IfGenerationNotMatch = 2L
                };
                options.ModifyRequest(request);
            });
            Assert.Throws <ArgumentException>(() =>
            {
                var options = new PatchObjectOptions {
                    IfMetagenerationMatch = 1L, IfMetagenerationNotMatch = 2L
                };
                options.ModifyRequest(request);
            });
        }
Example #4
0
        public void ModifyRequest_NegativeMatchOptions()
        {
            var request = new PatchRequest(null, null, "bucket", "object");
            var options = new PatchObjectOptions
            {
                Generation               = 1L,
                IfGenerationNotMatch     = 2L,
                IfMetagenerationNotMatch = 3L,
                PredefinedAcl            = PredefinedObjectAcl.AuthenticatedRead,
                Projection               = Projection.Full
            };

            options.ModifyRequest(request);
            Assert.Equal(1L, request.Generation);
            Assert.Null(request.IfGenerationMatch);
            Assert.Equal(2L, request.IfGenerationNotMatch);
            Assert.Null(request.IfMetagenerationMatch);
            Assert.Equal(3L, request.IfMetagenerationNotMatch);
            Assert.Equal(PredefinedAclEnum.AuthenticatedRead, request.PredefinedAcl);
            Assert.Equal(ProjectionEnum.Full, request.Projection);
        }
        // *************************************************************************************************************
        // PATCH OBJECT


        public override Object PatchObject(
            Object obj,
            PatchObjectOptions options = null)
        {
            return(obj);
        }