예제 #1
0
        public void DeleteAllforCacheTest()
        {
            const int cacheId = 477;

            // no images in db for that cache
            Assert.IsFalse(target.DeleteAllForCache(cacheId));
        }
예제 #2
0
        public bool DeleteCache(int cacheId)
        {
            ValidateCacheOwner(cacheId);

            // check if there are no assigned log entries or ratings
            if (logEntryDao.GetLogEntriesForCache(cacheId).Count == 0 ||
                ratingDao.GetRatingsForCache(cacheId).Count == 0)
            {
                imageDao.DeleteAllForCache(cacheId);
                return(cacheDao.Delete(cacheId));
            }
            throw new Exception("Error: Unable to delete cache due to assigned log entries/ratings.");
        }