public void DeleteMultiObjectsVerboseTest()
        {
            var count = new Random().Next(2, 20);
            LogUtility.LogMessage("Will create {0} objects for multi delete this time", count);
            var objectkeys = CreateMultiObjects(count);
            LogUtility.LogMessage("{0} objects have been created", count);

            var doRequest = new DeleteObjectsRequest(_bucketName, objectkeys, false);
            var doResponse = _ossClient.DeleteObjects(doRequest);
            //verbose mode would return all object keys
            Assert.AreEqual(count, doResponse.Keys.Count());
        }
        public void DeleteMultiObjectsQuietTest()
        {
            var count = new Random().Next(2, 20);
            LogUtility.LogMessage("Will create {0} objects for multi delete this time", count);
            var objectkeys = CreateMultiObjects(count);
            LogUtility.LogMessage("{0} objects have been created", count);

            var doRequest = new DeleteObjectsRequest(_bucketName, objectkeys);
            var doResponse = _ossClient.DeleteObjects(doRequest);
            //quiet mode won't return object keys
            Assert.IsNull(doResponse.Keys);
        }
        public void DeleteObjectsWithHiddenCharacters()
        {
            char[] buffer = new char[2];
            buffer[0] = Convert.ToChar(0x1c);
            buffer[1] = Convert.ToChar(0x1a);

            var newKey1 = _keyName + (new string(buffer)) + ".1.cd";
            var newKey2 = _keyName + (new string(buffer)) + ".2.cd";
            var newKey3 = _keyName + ".3.cd";

            try
            {
                _ossClient.PutObject(_bucketName, newKey1, Config.UploadSampleFile);
                _ossClient.PutObject(_bucketName, newKey2, Config.UploadSampleFile);
                _ossClient.PutObject(_bucketName, newKey3, Config.UploadSampleFile);

                Assert.IsTrue(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey1));
                Assert.IsTrue(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey2));
                Assert.IsTrue(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey3));

                var keys = new List<string>();
                keys.Add(newKey1);
                keys.Add(newKey2);
                keys.Add(newKey3);

                var request = new DeleteObjectsRequest(_bucketName, keys);
                _ossClient.DeleteObjects(request);

                Assert.IsFalse(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey1));
                Assert.IsFalse(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey2));
                Assert.IsFalse(OssTestUtils.ObjectExists(_ossClient, _bucketName, newKey3));
            }
            finally
            {
                _ossClient.DeleteObject(_bucketName, newKey1);
                _ossClient.DeleteObject(_bucketName, newKey2);
                _ossClient.DeleteObject(_bucketName, newKey3);
            }
        }