Resource repository tests and refactoring