public void can_delete_autor()
 {
     IAutorDao autorDao = new NHibernateDaoFactory().getAutorDao();
     Autor a = autorDao.GetById(147L, true);
     if(a != null)
         autorDao.delete(a);
 }
        public void replace(ISet<long> replaceable, long replacement)
        {
            ITrackDao trackDao = new NHibernateDaoFactory().getTrackDao();

            Track substitue = trackDao.GetById(replacement, true);

            ISession s = NHibernateSessionManager.Instance.GetSession();
            IList<Track> tracks = s.CreateQuery("from Track t where t.Id in (:idList)").SetParameterList("idList", replaceable).List<Track>();

            IList<Einsatz> updateableEinsaetze = s.CreateQuery("from Einsatz e where e.Track in (:tracks)")
                .SetParameterList("tracks", tracks)
                .List<Einsatz>();

            foreach(Einsatz einsatz in updateableEinsaetze)
                einsatz.Track = substitue;

            trackDao.commitChanges();

            foreach(Track track in tracks)
                trackDao.delete(track);

            trackDao.commitChanges();
        }