More Test Coverage

Lots of refactoring and magic like dependency injection.

wow.... such coverage... much test cases.... so unit...