Added testing units and cleaned the code

Added ServerTest, DatabaseTest,
Cleaned the codes on Server, Database, Client