diff options
author | Rolf Bjarne Kvinge <rolf@xamarin.com> | 2016-09-29 13:01:49 +0300 |
---|---|---|
committer | Rolf Bjarne Kvinge <rolf@xamarin.com> | 2016-09-29 13:01:49 +0300 |
commit | ad6f78afec8fcb01a38e83ba7f4a4ec515b1f808 (patch) | |
tree | 49037e492d2756dc5244f6e50af396974317e8e7 /mcs/class/System/Test | |
parent | ae4b2d859a1d9a6df84044c789ba436b1cf127ee (diff) |
[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.
Diffstat (limited to 'mcs/class/System/Test')
3 files changed, 9 insertions, 3 deletions
diff --git a/mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs b/mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs index 8c163f77b02..d3a39e41315 100644 --- a/mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs +++ b/mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs @@ -34,6 +34,7 @@ namespace MonoTests.System.Net.Mail [TearDown] public void TearDown () { + _smtp = null; if (Directory.Exists (tempFolder)) Directory.Delete (tempFolder, true); } diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs index d09341b9710..fff160c768c 100644 --- a/mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs @@ -48,10 +48,9 @@ namespace MonoTests.System.Net.Sockets if (listenSocket.AcceptAsync(asyncEventArgs)) return; acceptedSocket = asyncEventArgs.AcceptSocket; + mainEvent.Set(); } catch (Exception e) { ex = e; - } finally { - mainEvent.Set(); } }); Assert.IsTrue(readyEvent.WaitOne(1500)); @@ -64,7 +63,7 @@ namespace MonoTests.System.Net.Sockets clientSocket.NoDelay = true; Assert.IsTrue(mainEvent.WaitOne(1500)); - Assert.AreEqual(serverSocket, acceptedSocket); + Assert.AreEqual(serverSocket, acceptedSocket, "x"); mainEvent.Reset(); if (acceptedSocket != null) diff --git a/mcs/class/System/Test/System.Net/HttpListenerTest.cs b/mcs/class/System/Test/System.Net/HttpListenerTest.cs index bbd716c0ed2..09d3cb0f3f2 100644 --- a/mcs/class/System/Test/System.Net/HttpListenerTest.cs +++ b/mcs/class/System/Test/System.Net/HttpListenerTest.cs @@ -44,6 +44,12 @@ namespace MonoTests.System.Net { get { return _port ?? (_port = NetworkHelpers.FindFreePort ()).Value; } } + [TearDown] + public void Teardown () + { + _port = null; + } + [Test] #if FEATURE_NO_BSD_SOCKETS [ExpectedException (typeof (PlatformNotSupportedException))] |