While working on PR #11829 I stress-tested the tests by running multiple test
runs in parallel, and it turned out that many tests were not parallel-safe,
because they used the same temporary file names and ended up stomping on
eachother.
So I implemented a helper method that creates a guaranteed unique temporary
directory, and I've changed all tests to use this new helper method.
This brings the internal `MailAddressParser` class and switches `MailAddress` and `MailAddressCollection` to the CoreFX version.
The tests have been updated to reflect the CoreFX behavior, which is more strict about rejecting invalid addresses.
* I got confused between [TestFixtureSetup] and [Setup], so fix tests whose
[Setup] methods were changed/removed to properly clean up after each test
(using a [TearDown] method) so that the next time the on-demand creation of
objects works as expected (i.e. objects created in the [Setup] method should
be created on-demand once for each method instead of once for each class).
* Also fix SocketAcceptAsyncTest, the change to properly catch exceptions on
background threads was incorrect.
* [System] Fix line endings for a few files.
Best reviewed by not showing whitespace changes (should be empty diff in that case).
* [System] Fix potential crash in CookieParserTests.
Socket.EndAccept can throw an exception, which will crash the process if it
happens on a threadpool. So handle any exceptions when calling
Socket.EndAccept, and propagate those exceptions out of any threadpool code.
* [System.Net.Http] Throw a PlatformNotSupported exception when using HttpClientHandler on watchOS.
* [System.Net.Http] Tweak tests after watchOS API change.
Unfortunately the [ExpectedException] attribute can't be put on an entire
class, so remove the [Category ("RequiresBSDSockets")] attribute on the class
and instead decorate each test with an [ExpectedException] attribute.
* [System] Extract the HttpListenerResponseHelper class to a separate file.
Extract the HttpListenerResponseHelper class to a separate file so that it's
easier to replace the HttpListenerResponse implementation by using a different
file.
* [System] Throw a PlatformNotSupported exception when using the networking stack on watchOS.
* [System] Tweak tests after watchOS API changes.
Unfortunately the [ExpectedException] attribute can't be put on an entire
class, so remove the [Category ("RequiresBSDSockets")] attribute on the class
and instead decorate each test with an [ExpectedException] attribute.
* [System] Fix potential crash in SocketAcceptAsyncTest.
Fix potential crash in SocketAcceptAsyncTest by catching any exceptions in
code executed on the threadpool so that we never end up with unhandled
exceptions (which may terminate the process).
* [System] Avoid logic in SetUp attributes in tests.
Any type of exception in [SetUp] attributes causes all tests to fail with that
exception.
This even happens for tests that do not need the logic in the [SetUp]
attribute.
So rewrite tests a bit to not use [SetUp] when we can reasonably avoid it, and
instead instantiate class-level variables on first use. This ensures that any
exceptions that occur when initializing those variables are attributed to the
corresponding test, and not all of them.
* [System] Make exception handler (for test) catch more exceptions to avoid unhandled exceptions causing process termination.
* [System] Remove Obsolete attribute on API that throws PNSE.
MS. Removed upper limit check for Port. Modified Send to no longer
allow a whitespace-only Host. Moved checks for SpecifiedPickupDirectory
delivery method to SendFile, and use Path.IsPathRooted to check for
absolute paths instead of using a unix-only check. In Send, wrap all
non-SMTP errors in an SmtpException.
* SmtpException.cs: Correctly chain up all .ctors. Removed extra
null check in deserialization .ctor.
* SmtpClientTest.cs: Added property tests. Added Send argument check
tests.
* SmtpExceptionTest.cs: Added .ctor and GetObjectData tests.
* System_test.dll.sources: Added SmtpExceptionTest.cs.
svn path=/trunk/mcs/; revision=110647
* ContentType.cs : for SubjectEncoding, null is returned instead of
ASCII (.net compat way). For this cosmetic change, BodyEncoding is
changed to fill ASCII automatically.
* MailMessage.cs : fixing cosmetic .net compatibility. Automatically
fill ASCII when guessed encoding is nothing.
* MailMessageTest.cs : fixed test to just compare codepage. I can't
stand with this trivial difference (w/ BOM or not) as regression,
and fixing this "regression" causes practical bug (garbage BOM
insertion).
svn path=/trunk/mcs/; revision=90771
fixed bug #339037.
* AlternateView.cs : CreateAlternateViewFromString() allows null
Encoding.
* SmtpClient.cs : looks like when Body is null and AlternativeViews
contains only 1 item, then the alternate view becomes as if it
were just a body. To make this possible, added couple of more
transfer-encoding conversion methods.
For more AlternateViews cases, Body is treated
as empty. With attachments it is even complicated: those alternate
views are just in one boundary, so do not send empty string.
Removed debug output (Console.WriteLine).
What a mess.
* AlternateViewTest.cs : added test for CreateAlternateViewFromString
with null Encoding arg.
svn path=/trunk/mcs/; revision=88850
* LinkedResource.cs : Now they are implemented and soon to be
supported. Fixed TransferEncoding (same as other AttachmentBase).
* LinkedResourceTest.cs : removed NotWorking.
svn path=/trunk/mcs/; revision=87888
* AlternateView.cs, AttachmentView.cs, AttachmentBase.cs :
reverted default back to TransferEncoding.Base64 again, and use
QuotedPrintable only when created from string.
No need to check null Stream at AlternateView.ctor(). See base.
* SmtpClient.cs : For multipart message, do not send body twice (it
still emits extraneous part, which should be fixed too).
Do not premise charset existence in every AttachmentBase.
* AlternateViewTest.cs : default TransferEncoding value is more
complicated.
svn path=/trunk/mcs/; revision=87814
* MailMessage.cs : Some entire refactory on BodyEncoding and
IsBodyHtml. BodyEncoding and SubjectEncoding are guessed when
Body and Subject are set for each.
* SmtpClient.cs :
Subject header is encoded according to RFC 2047.
Body is encoded according to RFC 2821.
Output Date header.
ToQuotedPrintable() should take encoding into consideration.
For SevenBit/Unknown TransferEncoding, just decode with ASCII.
In set_UseDefaultCredentials(), raise NIE only when value is true.
In set_Timeout(), raise an error when Send() is in progress.
* MailMessageTest.cs : added test for encoding guess.
svn path=/trunk/mcs/; revision=87585
Allow display name to be specified as part of the address. Fixes
bug #81854. Return zero-length string in DisplayName if no display
name is set.
* MailAddressTest.cs: Added tests for ctors and specifying display
name as part of address.
svn path=/trunk/mcs/; revision=79916
* MailMessage.cs: Add suport to the MailMessage constructor to
take a comma-separated list of addresses (Bug #80548).
svn path=/trunk/mcs/; revision=71401
* SmtpPermissionAttributeTest.cs: New. Unit tests for
SmtpPermissionAttribute.
* SmtpPermissionTest.cs: New. Unit tests for SmtpPermission.
svn path=/trunk/mcs/; revision=67188
* MailMessage.cs: add [MonoTODO] for FormatException in ctor,
throw ArugmentNullException's from the ctors,
add internal BodyContentType property,
change BodyEncoding to use BodyContentType,
change IsBodyHtml to use BodyContentType,
* SmtpClient.cs: set timeout initially to 100000,
don't throw ArgumentOutOfRangeException when Timeout = 0,
add [MonoTODO] for set_host, and throw Exceptions for it,
add [MonoTODO] for UseDefaultCredentials,
get messageContentType from the message,
use "127.0.0.1" for Host and 25 for Port
if host or port is not specified until reading
them from the configuration files is done
svn path=/trunk/mcs/; revision=55549