Esempio 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);
        }
Esempio n. 2
0
        public void SaveFolder_FolderDoesNotExist_FolderCreated()
        {
            Folder folder = new Folder();

            FolderManager.Save(folder);

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

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

            Assert.IsNotNull(folderFromDatabase);
        }