Added unit tests for EMM IOS client and code refactoring [jira](EMM-533)