Reorganize shared unit test code