mercredi 24 février 2016

Mock Azure DocumentDB DocumentClientException

I'm trying to write some unit tests around code that queries Azure Document DB. In particular, I'm trying to ensure that error handling works correctly. The only difficulty is that I can't mock the DocumentClientException class that the client library throws when it receives an error from DocumentDB. DocumentClientException implements ISerializable, so when I try to mock it (with Moq), I get an exception saying that the mock object failed to provide a deserialization constructor.

Has anyone successfully mocked the Azure DocumentDB document client exception? If so, how did you do it? Or is my testing strategy completely off?

Aucun commentaire:

Enregistrer un commentaire