Add encoder tests, refactor + fix code under test

* extract property ids into factory
* use ProperyId instead of string for dependency injection
* minor logic fixes