public void Can_update_existing_yearly_batting() { IYearlyPitchingRepository repository = new YearlyPitchingRepository(); var stat = repository.GetById(2); stat.SB = 65; repository.Save(stat); // use session to try to load the product using (ISession session = _sessionFactory.OpenSession()) { var fromDb = session.Get<YearlyPitching>(stat.Id); Assert.AreEqual(stat.SB, fromDb.SB); } }
public void Can_remove_existing_yearly_batting() { IYearlyPitchingRepository repository = new YearlyPitchingRepository(); var stat = repository.GetById(1); repository.Delete(stat); using (ISession session = _sessionFactory.OpenSession()) { var fromDb = session.Get<YearlyPitching>(stat.Id); Assert.IsNull(fromDb); } }
public void Can_get_existing_player_batting_by_id() { IYearlyPitchingRepository repository = new YearlyPitchingRepository(); var fromDb = repository.GetById(1); using (ISession session = _sessionFactory.OpenSession()) { session.Update(fromDb.Player); session.Update(fromDb.Team); Assert.IsNotNull(fromDb); Assert.AreEqual("Felix Hernandez", fromDb.Player.Name); Assert.AreEqual(2011, fromDb.Year); Assert.AreEqual("Seattle", fromDb.Team.City); } }