Simulating Email
Keith Brown on the Pluralsight Blog has a great example of how to simulate email functionality so that you aren’t hitting a real SMTP service. Just by using the configuration file you can drive the method which the System.Net.Mail uses to “send” the email. For production and system wide integration testing this should be your SMTP delivery (network); however, for local development you can switch to SpecifiedPickupDirectory. This just dumps a .eml file out to the specified directory which you can then check for. I wouldn’t use this for automated unit testing unless I was specifically testing a mail component that was hitting the System.Net.Mail directly, but very handy for local development integration tests.