.net - Unit Testing my Email Service -


How do I write a unit test for an entity that uses an external service such as System.Net.Mail?

Do I check a return value to see if there is an error in sending the email and do not think that anyone was successfully sent to it?

Create one for mail service.

In short, this would mean that you write a class that can change the behavior of sending mail. This way you can make different situations very easy for your test: a successful match, a failure, etc.

A good and brief introduction:

One more with code sample,


Comments