From aa75a48a070a6f22d37fb54c894f331855861fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= Date: Tue, 16 Jun 2009 04:21:58 +0000 Subject: =?UTF-8?q?2009-06-16=20Andr=C3=A9s=20G.=20Aragoneses=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WebConnection.cs: propagate the exception to the request. * WebException.cs: new internal ctor. * HttpWebRequest.cs: use new ctor to encapsulate the innerException. Fixes #323452. 2009-06-16 Andrés G. Aragoneses * WebRequestTest.cs: Drop NotWorking attrib, more accurate tests. svn path=/trunk/mcs/; revision=136198 --- mcs/class/System/Test/System.Net/ChangeLog | 4 ++++ mcs/class/System/Test/System.Net/WebRequestTest.cs | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'mcs/class/System/Test') diff --git a/mcs/class/System/Test/System.Net/ChangeLog b/mcs/class/System/Test/System.Net/ChangeLog index 4aa2eff6905..18aeb3fcf2e 100644 --- a/mcs/class/System/Test/System.Net/ChangeLog +++ b/mcs/class/System/Test/System.Net/ChangeLog @@ -1,3 +1,7 @@ +2009-06-16 Andrés G. Aragoneses + + * WebRequestTest.cs: Drop NotWorking attrib, more accurate tests. + 2009-06-09 Andrés G. Aragoneses * WebRequestTest.cs: Added tests for bug #323452. diff --git a/mcs/class/System/Test/System.Net/WebRequestTest.cs b/mcs/class/System/Test/System.Net/WebRequestTest.cs index 2b218a0f106..4b5c176e3bd 100644 --- a/mcs/class/System/Test/System.Net/WebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/WebRequestTest.cs @@ -328,18 +328,20 @@ namespace MonoTests.System.Net { } [Test] //BNC#323452 - [Category ("NotWorking")] public void TestFailedConnection () { try { WebRequest.Create ("http://127.0.0.1:0/non-existant.txt").GetResponse (); Assert.Fail ("Should have raised an exception"); } catch (Exception e) { - Assert.IsTrue (e is WebException); + Assert.IsTrue (e is WebException, "Got " + e.GetType ().Name + ": " + e.Message); //#if NET_2_0 e.Message == "Unable to connect to the remote server" //#if NET_1_1 e.Message == "The underlying connection was closed: Unable to connect to the remote server." + Assert.AreEqual (((WebException)e).Status, WebExceptionStatus.ConnectFailure); + //#if !NET_1_1 (this is not true in .NET 1.x) + Assert.IsNotNull (e.InnerException); Assert.IsTrue (e.InnerException is Socks.SocketException, "InnerException should be SocketException"); //e.Message == "The requested address is not valid in its context 127.0.0.1:0" //#endif @@ -349,14 +351,14 @@ namespace MonoTests.System.Net { [Test] //BNC#323452 public void TestFailedResolution () { - string domain = "thisdomaindoesnotexist.monotestcase.x"; try { - WebRequest.Create ("http://" + domain + "/non-existant.txt").GetResponse (); + WebRequest.Create ("http://thisdomaindoesnotexist.monotestcase.x/non-existant.txt").GetResponse (); Assert.Fail ("Should have raised an exception"); } catch (Exception e) { Assert.IsTrue (e is WebException); //#if NET_2_0 e.Message == "The underlying connection was closed: The remote name could not be resolved." //#if NET_1_1 e.Message == "The remote name could not be resolved: 'thisdomaindoesnotexist.monotestcase.x'" + Assert.AreEqual (((WebException)e).Status, WebExceptionStatus.NameResolutionFailure); Assert.IsNull (e.InnerException); } } -- cgit v1.2.3