public void VerifyTheMappings() { // Create the initial copy var first = new TEntity(); // Set the "suggested" properties, including references // to other entities and possibly collections foreach (var o in _allProperties) { ((IPropertyValue)o).SetValue(first); } _repository.Save(first); _uow.Commit(); _uow.Dispose(); using (var newUow = new NHibernateUnitOfWork(_source)) { // Get a completely different IRepository newUow.Initialize(); var secondRepository = new NHibernateRepository <TId>(newUow); // "Find" the same entity from the second IRepository var second = secondRepository.Load <TEntity>(_idFunc(first)); // Validate that each specified property and value // made the round trip // It's a bit naive right now because it fails on the first failure foreach (var o in _allProperties) { ((IPropertyValue)o).CheckValue(second); } } }
public void Load_should_load_from_the_session() { var userID = Guid.NewGuid(); _repo.Load <User>(userID); _session.AssertWasCalled(s => s.Load <User>(userID)); }