Unit test manager

Some unit test for the manager package. I also added several mock structs for test purpose.