mardi 28 avril 2015

Setup Mock to redirect to overloaded method

I have a method called:

SendMail(string from, string to, string subject, string smtpServer)

and an overloaded Method

SendMail(string from, string to, string subject, SmtpClient smtpClient)

In my unit test I want to setup my MailService mock so that when the method SendMail(string, string, string, string) is called I want to instead call the overloaded method SendMail(string, string, string, SmtpClient) and modify the last parameter to a created SmtpClient test object.

Is there a way to do that?

Aucun commentaire:

Enregistrer un commentaire