Move test classes into test project and remove duplicate code