mercredi 6 mai 2015

How to unit test static void methods?

How does one go about unit testing static void methods? I have a few more questions:

  1. Is it necessary to unit test database queries like insert, select and update queries ? If so, how does one test them ?
  2. Is unit testing of every method required ? If not, are there any rules I should keep in mind when deciding what methods should be tested?
  3. How would I unit test a method that sends files from one system to another? The input to this method is just the IP address of the target system.
  4. What is the best way of testing private methods that I have written? I have changed the scope to public and tested them. Is this a bad practice?
  5. Must every unit test method have an assert statement? Is it possible to have a unit test without an assert statement? If so, how do I test it?

I am doing the unit testing in C# and I am using MSTest for testing.

Aucun commentaire:

Enregistrer un commentaire