public void CanQueryWithinUnitOfWorkScope() { using (new TestUnitOfWork()) { _repository.Save(_entity); _entity = _repository.Query() .SingleOrDefault(x => x.Id == _entity.Id); Assert.IsNotNull(_entity); } }
public void CaNotQueryDeleteSaveOrUpdateOutsideUnitOfWorkScope() { Assert.Throws<PersistenceException>( () => _repository.Save(_entity)); Assert.Throws<PersistenceException>( () => _repository.Update(_entity)); Assert.Throws<PersistenceException>( () => _repository.Delete(_entity)); Assert.Throws<PersistenceException>( () => _entity = _repository.Query() .SingleOrDefault(x => x.Id == _entity.Id)); }
public void Setup() { _repository = new TestRepository<EntityObject>(); _entity = new EntityObject { Name = "Candy", Description = "Delicious" }; }