Adding sorely missing unit tests!

@atesgoral - finally started work on this