Support generating MailAddress instances
See original GitHub issueIt would be great if FsCheck would be able to generate MailAddress
instances. I could work on this, but first I’d like to know if this is something that you’d support.
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (12 by maintainers)
Top Results From Across the Web
MailAddress Class (System.Net.Mail)
The MailAddress class supports the following mail address formats: A simple address format of user@host . If a DisplayName is not set, this...
Read more >Adding support email addresses for users to submit tickets
You can provide your users with alternative email addresses for submitting tickets. These addresses are known as support addresses.
Read more >How to find instance email address
Solved: Hi Is there some kind of hidden system property that holds a instance's email address?
Read more >Ideas for Creating a Professional Email Address + Examples
This guide provides the best practices and email ideas for businesses to help you create a professional email address. 1. Ease of pronunciation....
Read more >Professional Email Address Examples (Plus How To ...
Learn the purpose of having a professional email address, explore a how-to guide for creating an email address for work and review examples...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s probably because we only target net standard 1.6 now, which doesn’t have MailAddress. I’m planning to target 2.0 specifically as per nuget recommendations in the next minor release, which should solve that (if MailAddress is in the 2.0 API surface, that is).
As a an experienced programmer, I’d like a MailAddress generator to seek out as many exotic values as possible. You may want to consider the following, however:
If the target is to generate
MailAddress
values, you may need to constrain the generated values to those thatMailAddress
considers valid. It wouldn’t surprise me if there are strings that are considered valid according to whatever specification defines SMTP addresses, but thatMailAddress
doesn’t accept.On the other hand, if that’s the case, then .NET is open source too, as well 😉
The other issue worth considering is that some generated email addresses may represent real addresses.
When FsCheck is used against pure functions, that isn’t an issue, but if someone ever decides to use FsCheck for integration testing, a side effect could be that email are sent to real mail boxes.
If that ever happens, if someone wants to place the blame, the only reasonable target for the blame ought to be the developer who chose to use FsCheck against code that sends email. Still, some people aren’t reasonable, particularly when their ass is on the line, so we could hypothetically risk that someone tries to blame FsCheck.
I still think we should generate addresses according to all sorts of edge cases, but I think at least we should put a warning in the documentation to the effect that it may generate real addresses, and that it’s the users’ responsibility if emails are sent to real mail boxes as a result of running tests.