Fixes tests with memory repository. Some refactor on setup repository class.