Add unit test support

This is quite incomplete, but starts implementing unit tests to be run with ``nosetests``, such that Travis CI integration can quickly be enabled.