I’m currently doing a lot of work against Microsoft’s Exchange Web Services (EWS) API and wondering how can I manually trigger server behavior. I’m finding that while developing somewhat (once every few days) rare errors are appearing that I’m not 100% sure how to fix. The issue is that even if I implement a fix I have no reliable way of testing it. At this point I’m relying on the fact that the error will show up in one form or another at a later date. Even then, there is no guarantee.
For example, with EWS you can set up a streaming subscription where it will notify you whenever your mailbox receives a new email. One of the errors I get every once in a while is that my subscription ceases exists. This is easy to fix because all I have to do is simply create my streaming subscription again. My issue is that I don’t know how to test for this issue on an on-demand basis.
Thank you.
If you follow the onion-pattern you will encapsulate infrastructure components (including the Microsoft’s Exchange Web Services) into a wrapper class. Instead of calling the infrastructure component directly your code communicates with the wrapper.
So you are in controll of the wrapper and can implement a test/stub/mock/simulation to test certain aspects like email notification.