refactor command tests

Now based on code from sension-generator-bundle and at least somewhat sane...

See @todo annotations for existing problems.