Create or get specific SPTimeZone instance
To stop the discussion I decided to finally answer this question on my own.
There are several really helpful solutions in the comments which I want to gather in this short answer:
- Introducing a facade / adapter
- MS Fakes or other frameworks to
- fake access to SPTimeZone
- create a fake HttpContext
- go with the hack described in the question above ...
I for my part decided to go with MSFakes to shim the whole 3rd party call (since I didn't wan't to test its behavior anyways) and to shim all properties of SPTimeZone that I use in my method. Introducing an adapter unfortunately wasn't an option for me, since I had to preserve the (internal) API.