Unit test manager

Some unit test for the manager package. I also added several mock structs and helper functions for test purpose.
All this boilerplate makes me miss gMock :) I imagine some of this can be done through introspection (I'm not suggesting we do it though, just wondering whether the library could do it for its users)