3 ms·
Depends on what it is you're encapsulating. For example, we encapsulate our email sending service (Sendgrid). Sendgrid has a pretty good client library, so oth
by piaste 5y ago
Depends on what it is you're encapsulating.
For example, we encapsulate our email sending service (Sendgrid). Sendgrid has a pretty good client library, so other than providing a slightly more idiomatic F# API, our wrapper layer doesn't do much.
However, (1) sending email is a very straightforward service, so if Sendgrid ever becomes expensive, unreliable, or otherwise limited, replacing it with a different service is quite realistic. (As opposed to e.g. a database or caching layer where you would probably have to also review all the _logic_ if you switch to a different engine). And (2), we don't want to send real emails during tests (especially e.g. fuzzy or property which run en masse), so you actually want a honest-to-god mock here.
- xupybd 5y agoFor this reason I use the SMTP interface for Sendgrid. It also makes it easier to test. I can just throw up a MailHog instance and send mail there.