Esempio n. 1
0
        public void TestDeleteFile()
        {
            // Upload so we have something to delete //
            var jiffyResult = SharpCrush.UploadFile("./TestFiles/jiffy.gif");

            Assert.IsTrue(jiffyResult.Result == FileUploadResults.AlreadyUploaded || jiffyResult.Result == FileUploadResults.Successful);


            // == Try to delete out stuff == //

            var shouldDelete = SharpCrush.DeleteFile(jiffyResult.FileHash);

            // Deletion is broken: https://github.com/MediaCrush/MediaCrush/issues/356 //
            //TODO: Assert.IsTrue(shouldDelete == DeleteFileResult.Successful);



            // == Try to delete not our stuff == //

            var wontDelete = SharpCrush.DeleteFile("CPvuR5lRhmS0");

            Assert.IsTrue(wontDelete == DeleteFileResult.NotAllowed);



            // == Try to delete things that not exist == //

            var cantDelete = SharpCrush.DeleteFile("ThisDoesntExist");

            Assert.IsTrue(cantDelete == DeleteFileResult.FileNotFound);
        }
Esempio n. 2
0
 /// <summary>
 /// Deletes this file.
 /// </summary>
 /// <returns>The result of the file deletion</returns>
 /// <remarks>Same as doing <see cref="SharpCrush.DeleteFile(string)"/></remarks>
 public DeleteFileResult Delete()
 {
     return(SharpCrush.DeleteFile(FileHash));
 }