コード例 #1
0
ファイル: TestSuite4.cs プロジェクト: MediaCrush/SharpCrush
        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);
        }
コード例 #2
0
ファイル: TestSuite4.cs プロジェクト: MediaCrush/SharpCrush
        public void TestUploadFile()
        {
            var jaypegResult = SharpCrush.UploadFile("./TestFiles/jaypeg.jpg");

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

            var jiffyResult = SharpCrush.UploadFile("./TestFiles/jiffy.gif");

            Assert.IsTrue(jiffyResult.Result == FileUploadResults.AlreadyUploaded || jiffyResult.Result == FileUploadResults.Successful);
        }
コード例 #3
0
ファイル: TestSuite4.cs プロジェクト: MediaCrush/SharpCrush
        public void TestGetFileStatus()
        {
            var jaypeg = SharpCrush.UploadFile("./TestFiles/jaypeg.jpg");

            var stat1 = jaypeg.Status;

            // OR

            var stat2 = SharpCrush.GetFileStatus(jaypeg.FileHash);

            // The only way this would fail, is if they status changed with in the execution of stat1 and stat2. So about ~ 5ms //
            Assert.IsTrue(stat1 == stat2);

            // Will fail. See: https://github.com/MediaCrush/MediaCrush/issues/356 //
            Assert.IsTrue(stat1 == GetFileStatusResult.Done || stat1 == GetFileStatusResult.Processing);
        }