Added test worker for unit tests - fixes #413

Seems to work fine for me, but let me know if this needs some more unit tests.