16 Commits
Author SHA1 Message Date
Rolf Bjarne Kvinge 632bb59b21 [System] Implement a helper function to create unique temporary directories and use it in tests. (#11831)
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.
2018-12-04 16:43:23 +01:00
Rolf Bjarne Kvinge ad6f78afec [System] Fix tests that regressed in e6536dd.
* 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.
2016-09-29 12:01:49 +02:00
Rolf Bjarne Kvinge e6536dd5e1 [System*] Throw a PlatformNotSupported exception when using the networking stack on watchOS. (#3606)
* [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.
2016-09-27 13:13:38 +02:00
Rolf Bjarne Kvinge 51de6e83eb [System*] Add category for tests that use API that require BSD sockets.
We don't have access to BSD sockets on watchOS, so that API
doesn't work.

With this category we'll be able to exclude these tests.
2016-07-26 13:20:51 +02:00
Rolf Bjarne Kvinge 3c9209bb42 [System] Fix SmtpClientTest.Deliver_Async to not require main thread processing. 2015-11-25 14:04:34 +01:00
Zoltan Varga 33b8baa99d Revert "[bcl] Mark some System tests which depend on a working dns with InetAccess."
This reverts commit d644cb2ab3.

Revert this, localhost needs to be resolvable.
2015-11-06 21:50:04 -05:00
Zoltan Varga d644cb2ab3 [bcl] Mark some System tests which depend on a working dns with InetAccess. 2015-11-06 21:44:24 -05:00
Ludovic Henry 23a11611ec [tests] Increase timeout before failing 2015-10-26 14:13:03 +00:00
Marcos Henrich 96e40c5793 [System] Fixes SmtpClientTest.Deliver_Async 2015-09-30 10:44:31 +01:00
Adam Burgess d89373d85e [System] Fix SmtpClient.SendMailAsync never completing 2015-09-22 04:43:12 +10:00
Alexander Köplinger 746650d1b9 [bcl] Remove more NET_2_0 checks from class libs 2015-01-17 05:45:39 +01:00
Raja R Harinath cc50d3ac37 Implement envelope sender semantics in SmtpClient
* System.Net.Mail/SmtpClient.cs (SendCore): Compute envelope sender
separately from the 'From: ' header.
* Test/System.Net.Mail/SmtpClientTest.cs (Deliver_Envelope): New.
2010-08-04 09:57:08 +05:30
Raja R Harinath 57f8ebd654 Add a dummy SmtpServer to talk to our SmtpClient in unit tests
* SmtpServer.cs: New.
* SmtpClientTest.cs (Deliver): New.  Use it.
2010-08-04 09:57:08 +05:30
Gert Driesen 13213bdd61 * SmtpClient.cs: Fixed paramname of Argument(Null)Exceptions to match
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
2008-08-16 12:34:38 +00:00
Gert Driesen 90f556e712 * SmtpClient.cs: Added tests for default values.
svn path=/trunk/mcs/; revision=71486
2007-01-22 22:53:56 +00:00
John Luke 5b0d1a659f 2006-1-13 John Luke <[email protected]>
* 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
2006-01-13 20:55:56 +00:00