public void Can_remove_existing_Team() { var Team = new Team() { Id = 1 }; ITeamRepository repository = new TeamRepository(); repository.Delete(Team); using (ISession session = _sessionFactory.OpenSession()) { var fromDb = session.Get<Team>(Team.Id); Assert.IsNull(fromDb); } }
public void Can_update_existing_Team() { ITeamRepository repository = new TeamRepository(); var Team = new Team() { Id = 1, City = "Atlanta" }; repository.Save(Team); // use session to try to load the product using (ISession session = _sessionFactory.OpenSession()) { var fromDb = session.Get<Team>(Team.Id); Assert.AreEqual(Team.City, fromDb.City); } }
public void Can_add_new_Team() { var Team = new Team { City = "Pittsburgh" }; ITeamRepository repository = new TeamRepository(); repository.Save(Team); // use session to try to load the product using (ISession session = _sessionFactory.OpenSession()) { var fromDb = session.Get<Team>(Team.Id); // Test that the product was successfully inserted Assert.IsNotNull(fromDb); Assert.AreNotSame(Team, fromDb); Assert.AreEqual(Team.City, fromDb.City); } }