Test cleanup

This pull requests contains several commits that clean up the unit tests wrt. to logic and style.