コード例 #1
0
        /// <summary>
        /// Delete file.
        /// </summary>
        /// <param name="fileId"></param>
        /// <returns></returns>
        public async Task <bool> DeleteFile(string fileId)
        {
            var targetUrl = await GetTargetUrl(fileId);

            var result = await _volumeWrapper.CheckFileExist(targetUrl, fileId);

            if (result)
            {
                await _volumeWrapper.DeleteFile(targetUrl, fileId);
            }
            return(result);
        }
コード例 #2
0
        public void DeleteFile()
        {
            var values = new AssignFileKeyParams();
            var result = MasterWrapper.AssignFileKey(values).GetAwaiter().GetResult();

            VolumeWrapper.UploadFile(
                result.Url,
                result.FileId,
                "test.txt",
                new MemoryStream(Encoding.ASCII.GetBytes("@deleteFile")),
                null).GetAwaiter().GetResult();
            var fileExists = VolumeWrapper.CheckFileExist(result.Url, result.FileId).GetAwaiter().GetResult();

            VolumeWrapper.DeleteFile(result.Url, result.FileId).GetAwaiter().GetResult();
            var fileExists2 = VolumeWrapper.CheckFileExist(result.Url, result.FileId).GetAwaiter().GetResult();

            Assert.AreNotEqual(fileExists, fileExists2);
        }