Skip to main content
2 of 4
edited tags
Péter Török
  • 46.6k
  • 16
  • 163
  • 185

Unit testing methods that call suppliers webservices

I have a class with one public method Send() and a few private methods. It calls a couple of webservices and processes the reponse. The processing is done in private methods.

I want to unit test the code. My understanding is that unit tests should test my code in isolation (ie mock up supplier responses).

I also believe that private methods should not need to be unit tested (see here) But if I just test the Send() method my code isnt being tested in isolation and is dependent on the supplier resonse.

Should I then make my private methods public so I can test them with mock responses? It seems bad practice since I only the class should need to call them.

Apologies if its a basic question, im fairly new to unit testing.

Im using c# and VS2010

Tom Squires
  • 17.8k
  • 11
  • 70
  • 88