public void DeleteFolderTest()
        {
            GoogleDriveResultWithData <GoogleDriveFolder> createdFolder = null;

            try
            {
                createdFolder = GoogleDriveUtility.CreateFolder(GetConnection(), TestData.TestFolderName, testFolder.Id);
                Assert.IsTrue(createdFolder.IsSucceed);

                var folderListBefore = GoogleDriveUtility.GetFolders(GetConnection(), testFolder.Id);
                Assert.IsTrue(folderListBefore.IsSucceed);

                GoogleDriveUtility.DeleteResource(GetConnection(), createdFolder.Data.Id);

                var folderListAfter = GoogleDriveUtility.GetFolders(GetConnection(), testFolder.Id);
                Assert.IsTrue(folderListAfter.IsSucceed);

                Assert.AreEqual(1, folderListBefore.Data.Length - folderListAfter.Data.Length);
            }
            finally
            {
                try
                {
                    if (createdFolder != null)
                    {
                        GoogleDriveUtility.DeleteResource(GetConnection(), createdFolder.Data.Id);
                    }
                }
                catch { }
            }
        }
Ejemplo n.º 2
0
        public void UploadFileTest()
        {
            GoogleDriveResultWithData <GoogleDriveFile> uploadResult = null;

            try
            {
                uploadResult = GoogleDriveUtility.UploadFile(GetConnection(), TestFileFullName, null, testFolder.Id);
                Assert.IsTrue(uploadResult.IsSucceed);
                Assert.IsNotNull(uploadResult.Data);
            }
            finally
            {
                if (uploadResult != null && uploadResult.Data != null)
                {
                    GoogleDriveUtility.DeleteResource(GetConnection(), uploadResult.Data.Id);
                }
            }
        }
        public void CreateFolderTest()
        {
            GoogleDriveResultWithData <GoogleDriveFolder> createdFolder = null;

            try
            {
                createdFolder = GoogleDriveUtility.CreateFolder(GetConnection(), TestData.TestFolderName, testFolder.Id);
                Assert.IsTrue(createdFolder.IsSucceed);
                Assert.IsNotNull(createdFolder.Data);
            }
            finally
            {
                if (createdFolder != null)
                {
                    GoogleDriveUtility.DeleteResource(GetConnection(), createdFolder.Data.Id);
                }
            }
        }