I'm building a custom module by extending ActiveSocial for DotNetNuke and using ActiveSocial's API that I have no control over... and I'm trying to unit test my code (using C#).
In using this API - I can save images to AmazonS3 by calling their method and passing some info - including an HttpPostedFile object.
So in my unit testing (far from expert) I was thinking of just making sure the file type of the HttpPostedFile is what I want (jpg/png) before passing to the API. But I cannot mock out an HttpPostedFile.
I've google'd and msdn'd and seen where some people were using HttpPostedFileBase - but I cannot pass nor cast that to an HttpPostedFile to the API.
Granted - RIGHT NOW - my code doesn't do anything very complicated so I could just skip these types of test - but this beast is growing and will someday take over the world (fingers crossed) and I would therefore just like the confidence of the tests for if/when the complexity does change - nothing get's botched.
Any ideas/suggestions?
From a unit testing point of you, you should abstract away the parts that you don't have control over and test the parts that you do control. So you should mock out the ActiveSocial API and just test your own code. If you need any more help/guidance, it might be helpful if you included some code in your question.