Testing controllers that sends an email?
I am looking at the best way that I can test a few different controller methods that will send an email in the middle of the process. For example - I want to test that an email is sent when a user POSTs to the /forgot-password URL. The final result will be an Ok(). I also don't want to actually send the email.
I am using Sendgrid to handle the email sending process, I just repurposed the IEmailSender that comes with .NET Core 2.1 to keep it simple, and we are using Xunit for testing. Any tips on getting off the ground?
0 comments:
Post a Comment