diff options
author | Andrés G. Aragoneses <knocte@gmail.com> | 2009-06-16 08:21:58 +0400 |
---|---|---|
committer | Andrés G. Aragoneses <knocte@gmail.com> | 2009-06-16 08:21:58 +0400 |
commit | aa75a48a070a6f22d37fb54c894f331855861fe1 (patch) | |
tree | 4a0ec9450f7c084d448442734ad2e3788e28b8bc /mcs/class/System/Test | |
parent | 677f6012dbd794dca10fd18a8903dd76c7002c75 (diff) |
2009-06-16 Andrés G. Aragoneses <aaragoneses@novell.com>
* 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 <aaragoneses@novell.com>
* WebRequestTest.cs: Drop NotWorking attrib, more accurate tests.
svn path=/trunk/mcs/; revision=136198
Diffstat (limited to 'mcs/class/System/Test')
-rw-r--r-- | mcs/class/System/Test/System.Net/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System/Test/System.Net/WebRequestTest.cs | 10 |
2 files changed, 10 insertions, 4 deletions
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 <aaragoneses@novell.com> + + * WebRequestTest.cs: Drop NotWorking attrib, more accurate tests. + 2009-06-09 Andrés G. Aragoneses <aaragoneses@novell.com> * 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);
}
}
|