dropbox-sdk-dotnet
dropbox-sdk-dotnet copied to clipboard
Inability to mock DropboxClient for unit tests
Would it be possible for the DropboxClient to implement an interface, or do something that would allow for easier mocking with Moq, rather than having to use Fakes or wrap everything? If not do you guys have any suggestions on how I could unit test my services that use the DropboxClient?
DropboxClient takes in an optional HttpClient object as part of the DropboxClientConfig. So you can create a mocked http client (http://weblogs.asp.net/cibrax/unit-and-integration-testing-with-the-web-api-httpclient) and pass into DropboxClient. As long as you make the mock http client return a valid response json, DropboxClient should still work.
@qimingyuan This might cause tests to break if Dropbox format changes and we update to a new library, while actual code won't break (because library hides the specific JSON format).