Unit test manager

Some unit test for the manager package. I also added several mock structs and helper functions for test purpose.
I think the stats will be checked in line 129. If the argument to ``AddStats()`` is different from ``stats``, then it will report error.