I recently wrote a post on Sitecore unit testing with test fixtures. I’ve now added support for the media library (updated in the project on GitHub).
So now, you can also unit test code that imports an image into the media library.
And here’s some code to check if it works correctly.