Corrected test with repository pattern