Add tests for entity manager