public Cat GetCatById(long id) { ISession session = NhibernateHelper.GetSession(); Cat result = session.Get <Cat>(id); return(result); }
public long SaveCat(Cat cat) { ISession session = NhibernateHelper.GetSession(); session.Save(cat); session.Flush(); return(cat.Id.Value); }
public long SaveCatWithWrongValue(Cat cat) { ISession session = NhibernateHelper.GetSession(); session.Save(cat); cat.Name = "Wrong" + cat.Id; session.Flush(); return(cat.Id.Value); }
public void GetSession_NullConfig_ThrowsNullReferenceException() { NhibernateHelper helper = new NhibernateHelper(null); helper.GetSession(); }
public void GetSession_NormalCase_ReturnsSession() { NhibernateHelper helper = new NhibernateHelper(this.MockConfig.Object); ISession session = helper.GetSession(); Assert.AreEqual(typeof(NHibernate.Impl.SessionImpl), session.GetType()); }