Exemplo n.º 1
0
        public void DeleteFolder()
        {
            //  Create a new Folder and write it to the database.
            Folder folder = User.CreateAndAddFolder();

            FolderManager.Save(folder);

            //  Now delete the created Playlist and ensure it is removed.
            FolderManager.Delete(folder.Id);

            //  Remove entity from NHibernate cache to force DB query to ensure actually created.
            NHibernateSessionManager.Instance.Clear();

            Folder deletedFolder = FolderDao.Get(folder.Id);

            bool objectNotFoundExceptionEncountered = false;

            try
            {
                //  Evaluating a lazyily-loaded entity which isn't in the database will throw an ONF exception.
                Assert.IsNull(deletedFolder);
            }
            catch (ObjectNotFoundException)
            {
                objectNotFoundExceptionEncountered = true;
            }

            Assert.IsTrue(objectNotFoundExceptionEncountered);
        }
Exemplo n.º 2
0
        public JsonResult DeleteFolder(string path)
        {
            FolderManager.Delete(path);
            var res = new TreeViewModel {
                status = true, prompt = string.Empty
            };

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        internal static void Delete(IDataStore dataStore, Folder folder)
        {
            FolderManager manager = new FolderManager(dataStore);

            BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Delete(folder);

            Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status);
            Assert.IsNull(manager.GetFolder(folder.FolderId));

            Trace.WriteLine("Successfully deleted folder " + folder.FolderName);
        }