Refactor unittests
The unittests have grown quite significantly (which is very good thing!) but they could use some refactoring in order to be more maintainable and also provide more control while developing/debugging to only run a subset of the test suite.