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_add_new_yearly_batting() { var stat = new YearlyPitching() { Player = new Player { Name = "Joe Nathan", YahooId = 6 }, Year = 2011, Team = new Team() { City = "Minnesota", Nickname = "Twins" } }; IYearlyPitchingRepository repository = new YearlyPitchingRepository(); repository.Save(stat); // use session to try to load the product using (ISession session = _sessionFactory.OpenSession()) { var fromDb = session.Get<YearlyPitching>(stat.Id); // Test that the product was successfully inserted Assert.IsNotNull(fromDb); Assert.AreNotSame(stat, fromDb); Assert.AreEqual(stat.Player.Name, fromDb.Player.Name); Assert.AreEqual(stat.Year, fromDb.Year); Assert.AreEqual(stat.Team.City, fromDb.Team.City); } }