From 7d405be2c1ffa38522298ec87521d2704a0c8770 Mon Sep 17 00:00:00 2001 From: Robert Jordan Date: Fri, 26 Jun 2009 11:59:34 +0000 Subject: [PATCH] 2009-06-26 Robert Jordan * *.cs: Upgrade to new NUnit style. svn path=/trunk/mcs/; revision=136948 --- mcs/class/System/Test/System.Net/ChangeLog | 4 + .../Test/System.Net/CookieCollectionTest.cs | 34 +++--- .../System/Test/System.Net/CookieTest.cs | 56 +++++----- .../Test/System.Net/CredentialCacheTest.cs | 40 +++---- .../Test/System.Net/HttpWebRequestTest.cs | 20 ++-- .../System/Test/System.Net/IPEndPointTest.cs | 34 +++--- .../System.Net/ServicePointManagerTest.cs | 10 +- .../Test/System.Net/ServicePointTest.cs | 12 +- .../System.Net/WebHeaderCollectionTest.cs | 84 +++++++------- .../System/Test/System.Net/WebProxyTest.cs | 104 +++++++++--------- .../System/Test/System.Net/WebRequestTest.cs | 26 ++--- 11 files changed, 214 insertions(+), 210 deletions(-) diff --git a/mcs/class/System/Test/System.Net/ChangeLog b/mcs/class/System/Test/System.Net/ChangeLog index 1ca61e686d0..685b60e0bcc 100644 --- a/mcs/class/System/Test/System.Net/ChangeLog +++ b/mcs/class/System/Test/System.Net/ChangeLog @@ -1,3 +1,7 @@ +2009-06-26 Robert Jordan + + * *.cs: Upgrade to new NUnit style. + 2009-06-20 Gert Driesen * HttpWebRequestTest.cs: Improved and enabled test for bug #510642. diff --git a/mcs/class/System/Test/System.Net/CookieCollectionTest.cs b/mcs/class/System/Test/System.Net/CookieCollectionTest.cs index d94c2164115..87d2325bb17 100644 --- a/mcs/class/System/Test/System.Net/CookieCollectionTest.cs +++ b/mcs/class/System/Test/System.Net/CookieCollectionTest.cs @@ -33,7 +33,7 @@ public class CookieCollectionTest [Test] public void Count () { - Assertion.AssertEquals ("#1", col.Count, 3); + Assert.AreEqual (col.Count, 3, "#1"); } [Test] @@ -42,18 +42,18 @@ public class CookieCollectionTest Cookie c = null; try { c = col [-1]; - Assertion.Fail ("#1"); + Assert.Fail ("#1"); } catch (ArgumentOutOfRangeException) { } try { c = col [col.Count]; - Assertion.Fail ("#2"); + Assert.Fail ("#2"); } catch (ArgumentOutOfRangeException) { } c = col ["name1"]; - Assertion.AssertEquals ("#3", c.Name, "name1"); + Assert.AreEqual (c.Name, "name1", "#3"); c = col ["NAME2"]; - Assertion.AssertEquals ("#4", c.Name, "name2"); + Assert.AreEqual (c.Name, "name2", "#4"); } [Test] @@ -62,7 +62,7 @@ public class CookieCollectionTest try { Cookie c = null; col.Add (c); - Assertion.Fail ("#1"); + Assert.Fail ("#1"); } catch (ArgumentNullException) { } @@ -70,13 +70,13 @@ public class CookieCollectionTest // so we'll have to fail to. try { col.Add (col); - Assertion.Fail ("#2"); + Assert.Fail ("#2"); } catch (Exception) { } - Assertion.AssertEquals ("#3", col.Count, 3); + Assert.AreEqual (col.Count, 3, "#3"); col.Add (new Cookie("name1", "value1")); - Assertion.AssertEquals ("#4", col.Count, 3); + Assert.AreEqual (col.Count, 3, "#4"); CookieCollection col2 = new CookieCollection(); Cookie c4 = new Cookie("name4", "value4"); @@ -84,9 +84,9 @@ public class CookieCollectionTest col2.Add (c4); col2.Add (c5); col.Add (col2); - Assertion.AssertEquals ("#5", col.Count, 5); - Assertion.AssertEquals ("#6", col ["NAME4"], c4); - Assertion.AssertEquals ("#7", col [4], c5); + Assert.AreEqual (col.Count, 5, "#5"); + Assert.AreEqual (col ["NAME4"], c4, "#6"); + Assert.AreEqual (col [4], c5, "#7"); } [Test] @@ -94,9 +94,9 @@ public class CookieCollectionTest { Array a = Array.CreateInstance (typeof (Cookie), 3); col.CopyTo (a, 0); - Assertion.AssertEquals ("#1", a.GetValue (0), col [0]); - Assertion.AssertEquals ("#2", a.GetValue (1), col [1]); - Assertion.AssertEquals ("#3", a.GetValue (2), col [2]); + Assert.AreEqual (a.GetValue (0), col [0], "#1"); + Assert.AreEqual (a.GetValue (1), col [1], "#2"); + Assert.AreEqual (a.GetValue (2), col [2], "#3"); } [Test] @@ -105,11 +105,11 @@ public class CookieCollectionTest IEnumerator enumerator = col.GetEnumerator (); enumerator.MoveNext (); Cookie c = (Cookie) enumerator.Current; - Assertion.AssertEquals ("#1", c, col [0]); + Assert.AreEqual (c, col [0], "#1"); col.Add (new Cookie ("name6", "value6")); try { enumerator.MoveNext (); - Assertion.Fail ("#2"); + Assert.Fail ("#2"); } catch (InvalidOperationException) { } } diff --git a/mcs/class/System/Test/System.Net/CookieTest.cs b/mcs/class/System/Test/System.Net/CookieTest.cs index 1bd5c64848c..b84dedb2aab 100644 --- a/mcs/class/System/Test/System.Net/CookieTest.cs +++ b/mcs/class/System/Test/System.Net/CookieTest.cs @@ -57,7 +57,7 @@ namespace MonoTests.System.Net try { c = new Cookie (null, null, null, null); - Assertion.Fail ("#1: Name cannot be null"); + Assert.Fail ("#1: Name cannot be null"); } catch (CookieException) { @@ -68,44 +68,44 @@ namespace MonoTests.System.Net public void Name () { Cookie c = new Cookie ("SomeName", "SomeValue"); - Assertion.AssertEquals ("#1", c.Name, "SomeName"); + Assert.AreEqual (c.Name, "SomeName", "#1"); try { c.Name = null; - Assertion.Fail ("#2a"); + Assert.Fail ("#2a"); } catch (CookieException) { - Assertion.AssertEquals ("#2b", "SomeName", c.Name); + Assert.AreEqual ("SomeName", c.Name, "#2b"); } try { c.Name = ""; - Assertion.Fail ("#2c"); + Assert.Fail ("#2c"); } catch (CookieException) { - Assertion.AssertEquals ("#2d", "SomeName", c.Name); + Assert.AreEqual ("SomeName", c.Name, "#2d"); } try { c.Name = " "; - Assertion.Fail ("#2e"); + Assert.Fail ("#2e"); } catch (CookieException) { // bah! this fails, yet the name is changed.. // inconsistent with previous test - Assertion.AssertEquals ("#2f", String.Empty, c.Name); + Assert.AreEqual (String.Empty, c.Name, "#2f"); } try { c.Name = "xxx\r\n"; - Assertion.Fail ("#2g"); + Assert.Fail ("#2g"); } catch (CookieException) { - Assertion.AssertEquals ("#2h", String.Empty, c.Name); + Assert.AreEqual (String.Empty, c.Name, "#2h"); } try { @@ -113,30 +113,30 @@ namespace MonoTests.System.Net } catch (CookieException) { - Assertion.Fail ("#2i"); + Assert.Fail ("#2i"); } try { c.Name = "$omeName"; - Assertion.Fail ("#3a: Name cannot start with '$' character"); + Assert.Fail ("#3a: Name cannot start with '$' character"); } catch (CookieException) { - Assertion.AssertEquals ("#3b", String.Empty, c.Name); + Assert.AreEqual (String.Empty, c.Name, "#3b"); } c.Name = "SomeName$"; - Assertion.AssertEquals ("#4", c.Name, "SomeName$"); + Assert.AreEqual (c.Name, "SomeName$", "#4"); try { c.Name = "Some=Name"; - Assertion.Fail ("#5a: Name cannot contain '=' character"); + Assert.Fail ("#5a: Name cannot contain '=' character"); } catch (CookieException) { - Assertion.AssertEquals ("#5b", String.Empty, c.Name); + Assert.AreEqual (String.Empty, c.Name, "#5b"); } c.Name = "domain"; - Assertion.AssertEquals ("#6", c.Name, "domain"); + Assert.AreEqual (c.Name, "domain", "#6"); } [Test] @@ -162,16 +162,16 @@ namespace MonoTests.System.Net Cookie c = new Cookie("SomeName", "SomeValue"); try { c.Value = "Some;Value"; - Assertion.Fail ("#1: semicolon should not be accepted"); + Assert.Fail ("#1: semicolon should not be accepted"); } catch (CookieException) { } try { c.Value = "Some,Value"; - Assertion.Fail ("#2: comma should not be accepted"); + Assert.Fail ("#2: comma should not be accepted"); } catch (CookieException) { } c.Value = "Some\tValue"; - Assertion.AssertEquals ("#3", c.Value, "Some\tValue"); + Assert.AreEqual (c.Value, "Some\tValue", "#3"); */ } @@ -182,7 +182,7 @@ namespace MonoTests.System.Net try { c.Port = "123"; - Assertion.Fail ("#1: port must start and end with double quotes"); + Assert.Fail ("#1: port must start and end with double quotes"); } catch (CookieException) { @@ -195,12 +195,12 @@ namespace MonoTests.System.Net } catch (CookieException) { - Assertion.Fail ("#2"); + Assert.Fail ("#2"); } try { c.Port = "\"123;124\""; - Assertion.Fail ("#3"); + Assert.Fail ("#3"); } catch (CookieException) { @@ -211,7 +211,7 @@ namespace MonoTests.System.Net } catch (CookieException) { - Assertion.Fail ("#4"); + Assert.Fail ("#4"); } try { @@ -219,7 +219,7 @@ namespace MonoTests.System.Net } catch (CookieException) { - Assertion.Fail ("#5"); + Assert.Fail ("#5"); } } @@ -228,12 +228,12 @@ namespace MonoTests.System.Net { Cookie c1 = new Cookie ("NAME", "VALUE", "PATH", "DOMAIN"); Cookie c2 = new Cookie ("name", "value", "path", "domain"); - Assertion.Assert ("#1", !c1.Equals (c2)); + Assert.IsTrue (!c1.Equals (c2), "#1"); c2.Value = "VALUE"; c2.Path = "PATH"; - Assertion.Assert ("#2", c1.Equals (c2)); + Assert.IsTrue (c1.Equals (c2), "#2"); c2.Version = 1; - Assertion.Assert ("#3", !c1.Equals (c2)); + Assert.IsTrue (!c1.Equals (c2), "#3"); } [Test] diff --git a/mcs/class/System/Test/System.Net/CredentialCacheTest.cs b/mcs/class/System/Test/System.Net/CredentialCacheTest.cs index c04e4429360..a1d5f79c11a 100644 --- a/mcs/class/System/Test/System.Net/CredentialCacheTest.cs +++ b/mcs/class/System/Test/System.Net/CredentialCacheTest.cs @@ -42,56 +42,56 @@ public class CredentialCacheTest try { c.Add (new Uri("http://www.ximian.com"), "Basic", cred1); - Assertion.Fail ("#1: should have failed"); + Assert.Fail ("#1: should have failed"); } catch (ArgumentException) { } c.Add (new Uri("http://www.contoso.com/"), "**Unknown**", cred1); result = c.GetCredential (new Uri("http://www.contoso.com/"), "**Unknown**"); - Assertion.AssertEquals ("#3", result, cred1); + Assert.AreEqual (result, cred1, "#3"); c.Remove (new Uri("http://www.contoso.com/"), "**Unknown**"); result = c.GetCredential (new Uri("http://www.contoso.com/"), "**Unknown**"); - Assertion.Assert ("#4", result == null); + Assert.IsTrue (result == null, "#4"); c.Add (new Uri("http://www.contoso.com/"), "**Unknown**", cred1); result = c.GetCredential (new Uri("http://www.contoso.com"), "**Unknown**"); - Assertion.AssertEquals ("#5", result, cred1); + Assert.AreEqual (result, cred1, "#5"); c.Remove (new Uri("http://www.contoso.com"), "**Unknown**"); result = c.GetCredential (new Uri("http://www.contoso.com"), "**Unknown**"); - Assertion.Assert ("#6", result == null); + Assert.IsTrue (result == null, "#6"); c.Add (new Uri("http://www.contoso.com/portal/"), "**Unknown**", cred1); result = c.GetCredential (new Uri("http://www.contoso.com/portal/foo/bar.html"), "**Unknown**"); - Assertion.AssertEquals ("#7", result, cred1); + Assert.AreEqual (result, cred1, "#7"); c.Remove (new Uri("http://www.contoso.com"), "**Unknown**"); result = c.GetCredential (new Uri("http://www.contoso.com"), "**Unknown**"); - Assertion.Assert ("#8", result == null); + Assert.IsTrue (result == null, "#8"); result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/news/index.aspx"), "Basic"); - Assertion.AssertEquals ("#9", result, cred3); + Assert.AreEqual (result, cred3, "#9"); result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/news/index"), "Basic"); - Assertion.AssertEquals ("#10", result, cred3); + Assert.AreEqual (result, cred3, "#10"); result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/news/"), "Basic"); - Assertion.AssertEquals ("#11", result, cred3); + Assert.AreEqual (result, cred3, "#11"); result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/news"), "Basic"); - Assertion.AssertEquals ("#12", result, cred4); + Assert.AreEqual (result, cred4, "#12"); result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/ne"), "Basic"); - Assertion.AssertEquals ("#13", result, cred4); + Assert.AreEqual (result, cred4, "#13"); result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/"), "Basic"); - Assertion.AssertEquals ("#14", result, cred4); + Assert.AreEqual (result, cred4, "#14"); result = c.GetCredential (new Uri("http://www.contoso.com:80/portal"), "Basic"); - Assertion.AssertEquals ("#15", result, cred5); + Assert.AreEqual (result, cred5, "#15"); result = c.GetCredential (new Uri("http://www.contoso.com:80/"), "Basic"); - Assertion.AssertEquals ("#16", result, cred5); + Assert.AreEqual (result, cred5, "#16"); result = c.GetCredential (new Uri("http://www.contoso.com"), "Basic"); - Assertion.AssertEquals ("#17", result, cred5); + Assert.AreEqual (result, cred5, "#17"); /* IEnumerator e = c.GetEnumerator (); @@ -101,22 +101,22 @@ public class CredentialCacheTest */ #if NET_2_0 result = c.GetCredential ("www.ximian.com", 80, "Basic"); - Assertion.Assert ("#18", result == null); + Assert.IsTrue (result == null, "#18"); c.Add ("www.ximian.com", 80, "Basic", cred1); try { c.Add ("www.ximian.com", 80, "Basic", cred1); - Assertion.Fail ("#19: should have failed"); + Assert.Fail ("#19: should have failed"); } catch (ArgumentException) { } result = c.GetCredential ("www.ximian.com", 80, "Basic"); - Assertion.AssertEquals ("#20", result, cred1); + Assert.AreEqual (result, cred1, "#20"); c.Remove (new Uri("http://www.contoso.com"), "Basic"); c.Add ("www.contoso.com", 80, "Basic", cred5); result = c.GetCredential (new Uri("http://www.contoso.com"), "Basic"); - Assertion.Assert ("#21", result == null); + Assert.IsTrue (result == null, "#21"); #endif } } diff --git a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs index 704914741b0..47c3abadff4 100644 --- a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs @@ -65,7 +65,7 @@ namespace MonoTests.System.Net public void Sync () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com"); - Assertion.AssertNotNull ("req:If Modified Since: ", req.IfModifiedSince); + Assert.IsNotNull (req.IfModifiedSince, "req:If Modified Since: "); req.UserAgent = "MonoClient v1.0"; Assert.AreEqual ("User-Agent", req.Headers.GetKey (0), "#A1"); @@ -90,10 +90,10 @@ namespace MonoTests.System.Net req.AddRange (50, 90); req.AddRange ("bytes", 100); req.AddRange ("bytes", 100, 120); - Assertion.AssertEquals ("#1", "bytes=10-,50-90,100-,100-120", req.Headers ["Range"]); + Assert.AreEqual ("bytes=10-,50-90,100-,100-120", req.Headers ["Range"], "#1"); try { req.AddRange ("bits", 2000); - Assertion.Fail ("#2"); + Assert.Fail ("#2"); } catch (InvalidOperationException) {} } @@ -141,14 +141,14 @@ namespace MonoTests.System.Net req.KeepAlive = false; req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv; 1.7.6) Gecko/20050317 Firefox/1.0.2"; req.CookieContainer = cookies; - Assertion.AssertEquals ("#01", 0, cookies.Count); + Assert.AreEqual (0, cookies.Count, "#01"); using (HttpWebResponse res = (HttpWebResponse) req.GetResponse()) { CookieCollection coll = req.CookieContainer.GetCookies (new Uri (url)); - Assertion.AssertEquals ("#02", 1, coll.Count); - Assertion.AssertEquals ("#03", 1, res.Cookies.Count); + Assert.AreEqual (1, coll.Count, "#02"); + Assert.AreEqual (1, res.Cookies.Count, "#03"); Cookie one = coll [0]; Cookie two = res.Cookies [0]; - Assertion.AssertEquals ("#04", true, object.ReferenceEquals (one, two)); + Assert.AreEqual (true, object.ReferenceEquals (one, two), "#04"); } } @@ -172,7 +172,7 @@ namespace MonoTests.System.Net stream.Write (bytes, 0, bytes.Length); stream.Close (); HttpWebResponse resp = (HttpWebResponse) request.GetResponse (); - Assertion.AssertEquals ("StatusCode", 200, (int) resp.StatusCode); + Assert.AreEqual (200, (int) resp.StatusCode, "StatusCode"); StreamReader sr = new StreamReader (resp.GetResponseStream (), Encoding.UTF8); string x = sr.ReadToEnd (); sr.Close (); @@ -229,7 +229,7 @@ namespace MonoTests.System.Net // Using StreamReader+UTF8Encoding here fails on MS runtime Stream stream = resp.GetResponseStream (); int nread = stream.Read (bytes, 0, 32); - Assertion.AssertEquals ("#01", 16, nread); + Assert.AreEqual (16, nread, "#01"); x = Encoding.ASCII.GetString (bytes, 0, 16); } finally { resp.Close (); @@ -239,7 +239,7 @@ namespace MonoTests.System.Net if (server.Error != null) throw server.Error; - Assertion.AssertEquals ("1234567890123456", x); + Assert.AreEqual ("1234567890123456", x); } [Test] diff --git a/mcs/class/System/Test/System.Net/IPEndPointTest.cs b/mcs/class/System/Test/System.Net/IPEndPointTest.cs index 990a988d4ad..057041ab74e 100644 --- a/mcs/class/System/Test/System.Net/IPEndPointTest.cs +++ b/mcs/class/System/Test/System.Net/IPEndPointTest.cs @@ -41,8 +41,8 @@ public class IPEndPointTest [Test] public void PublicFields () { - Assertion.AssertEquals ("MinPort", IPEndPoint.MinPort, MyMinPort); - Assertion.AssertEquals ("MaxPort", IPEndPoint.MaxPort, MyMaxPort); + Assert.AreEqual (IPEndPoint.MinPort, MyMinPort, "MinPort"); + Assert.AreEqual (IPEndPoint.MaxPort, MyMaxPort, "MaxPort"); } [Test] @@ -50,28 +50,28 @@ public class IPEndPointTest { try { new IPEndPoint (null, 0); - Assertion.Fail ("Should raise an ArgumentNullException"); + Assert.Fail ("Should raise an ArgumentNullException"); } catch (ArgumentNullException) { } try { new IPEndPoint (ipAddress, MyMinPort - 1); - Assertion.Fail ("Should raise an ArgumentOutOfRangeException #1"); + Assert.Fail ("Should raise an ArgumentOutOfRangeException #1"); } catch (ArgumentOutOfRangeException) { } try { new IPEndPoint (ipAddress, MyMaxPort + 1); - Assertion.Fail ("Should raise an ArgumentOutOfRangeException #2"); + Assert.Fail ("Should raise an ArgumentOutOfRangeException #2"); } catch (ArgumentOutOfRangeException) { } try { new IPEndPoint (ip, MyMinPort -1); - Assertion.Fail ("Should raise an ArgumentOutOfRangeException #3"); + Assert.Fail ("Should raise an ArgumentOutOfRangeException #3"); } catch (ArgumentOutOfRangeException) { } try { new IPEndPoint (ip, MyMaxPort + 1); - Assertion.Fail ("Should raise an ArgumentOutOfRangeException #4"); + Assert.Fail ("Should raise an ArgumentOutOfRangeException #4"); } catch (ArgumentOutOfRangeException) { } } @@ -81,12 +81,12 @@ public class IPEndPointTest { try { endPoint1.Port = MyMinPort - 1; - Assertion.Fail ("Should raise an ArgumentOutOfRangeException #1"); + Assert.Fail ("Should raise an ArgumentOutOfRangeException #1"); } catch (ArgumentOutOfRangeException) { } try { endPoint1.Port = MyMaxPort + 1; - Assertion.Fail ("Should raise an ArgumentOutOfRangeException #2"); + Assert.Fail ("Should raise an ArgumentOutOfRangeException #2"); } catch (ArgumentOutOfRangeException) { } } @@ -96,34 +96,34 @@ public class IPEndPointTest { SocketAddress addr = endPoint1.Serialize (); EndPoint endPoint3 = endPoint2.Create (addr); - Assertion.Assert ("#1", endPoint1.Equals (endPoint3)); + Assert.IsTrue (endPoint1.Equals (endPoint3), "#1"); IPAddress ipAddress = IPAddress.Parse ("255.255.255.255"); IPEndPoint endPoint4 = new IPEndPoint (ipAddress, MyMaxPort); addr = endPoint4.Serialize (); EndPoint endPoint5 = endPoint2.Create(addr); - Assertion.Assert ("#2", endPoint4.Equals (endPoint5)); - Assertion.AssertEquals ("#3", endPoint5.ToString (), "255.255.255.255:" + MyMaxPort); + Assert.IsTrue (endPoint4.Equals (endPoint5), "#2"); + Assert.AreEqual (endPoint5.ToString (), "255.255.255.255:" + MyMaxPort, "#3"); } [Test] public void Equals () { - Assertion.Assert("Equals", endPoint1.Equals (endPoint2)); - Assertion.Assert("Not Equals", !endPoint1.Equals (new IPEndPoint (ip, MyPort + 1))); + Assert.IsTrue (endPoint1.Equals (endPoint2), "Equals"); + Assert.IsTrue (!endPoint1.Equals (new IPEndPoint (ip, MyPort + 1)), "Not Equals"); } [Test] public void GetHashCodeTest () { - Assertion.AssertEquals(endPoint1.GetHashCode(), endPoint2.GetHashCode()); + Assert.AreEqual (endPoint1.GetHashCode(), endPoint2.GetHashCode()); } [Test] public void ToStringTest () { - Assertion.AssertEquals("ToString #1", endPoint1.ToString (), MyIPAddressString + ":" + MyPort); - Assertion.AssertEquals("ToString #2", endPoint2.ToString (), MyIPAddressString + ":" + MyPort); + Assert.AreEqual (endPoint1.ToString (), MyIPAddressString + ":" + MyPort, "ToString #1"); + Assert.AreEqual (endPoint2.ToString (), MyIPAddressString + ":" + MyPort, "ToString #2"); } } diff --git a/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs b/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs index a866fb5d41b..fe2f075b32e 100644 --- a/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs +++ b/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs @@ -19,7 +19,7 @@ namespace MonoTests.System.Net { [TestFixture] -public class ServicePointManagerTest : Assertion +public class ServicePointManagerTest { private Uri googleUri; private Uri yahooUri; @@ -49,7 +49,7 @@ public class ServicePointManagerTest : Assertion #endif public void MaxServicePointManagers () { - AssertEquals ("#1", 0, ServicePointManager.MaxServicePoints); + Assert.AreEqual (0, ServicePointManager.MaxServicePoints, "#1"); DoWebRequest (googleUri); Thread.Sleep (100); @@ -89,9 +89,9 @@ public class ServicePointManagerTest : Assertion { ServicePointManager.MaxServicePoints = 0; ServicePoint sp = ServicePointManager.FindServicePoint (googleUri, new WebProxy (apacheUri)); - AssertEquals ("#1", apacheUri, sp.Address); - AssertEquals ("#2", 2, sp.ConnectionLimit); - AssertEquals ("#3", "http", sp.ConnectionName); + Assert.AreEqual (apacheUri, sp.Address, "#1"); + Assert.AreEqual (2, sp.ConnectionLimit, "#2"); + Assert.AreEqual ("http", sp.ConnectionName, "#3"); } private void DoWebRequest (Uri uri) diff --git a/mcs/class/System/Test/System.Net/ServicePointTest.cs b/mcs/class/System/Test/System.Net/ServicePointTest.cs index 2a8983776d1..457dc5b29f1 100644 --- a/mcs/class/System/Test/System.Net/ServicePointTest.cs +++ b/mcs/class/System/Test/System.Net/ServicePointTest.cs @@ -47,7 +47,7 @@ public class ServicePointTest ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com")); try { ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org")); - Assertion.Fail ("#1"); + Assert.Fail ("#1"); } catch (InvalidOperationException) { } ServicePointManager.MaxServicePoints = 0; @@ -58,7 +58,7 @@ public class ServicePointTest //WriteServicePoint ("google after getting a response", google); ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html")); - Assertion.AssertEquals ("#equals", google, google2); + Assert.AreEqual (google, google2, "#equals"); res.Close (); // in both instances property CurrentConnections is 0 according to ms.net. @@ -168,27 +168,27 @@ public class ServicePointTest bool called = false; #if !TARGET_JVM sp.BindIPEndPointDelegate = delegate { - Assertion.Assert(!called); + Assert.IsTrue (!called); called = true; return null; }; #endif req.GetResponse ().Close (); - Assertion.Assert (called); + Assert.IsTrue (called); req = (HttpWebRequest) WebRequest.Create (uri); called = false; #if !TARGET_JVM sp.BindIPEndPointDelegate = delegate(ServicePoint point, IPEndPoint remote, int times) { - Assertion.Assert(times < 5); + Assert.IsTrue (times < 5); called = true; return new IPEndPoint(IPAddress.Parse("0.0.0.0"), 12345 + times); }; #endif req.GetResponse ().Close (); - Assertion.Assert(called); + Assert.IsTrue (called); } #endif diff --git a/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs b/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs index 8d335903796..384ba0eaf3e 100644 --- a/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs +++ b/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs @@ -40,44 +40,44 @@ namespace MonoTests.System.Net { try { col.Add (null); - Assertion.Fail ("#1"); + Assert.Fail ("#1"); } catch (ArgumentNullException) { } try { col.Add (""); - Assertion.Fail ("#2"); + Assert.Fail ("#2"); } catch (ArgumentException) { } try { col.Add (" "); - Assertion.Fail ("#3"); + Assert.Fail ("#3"); } catch (ArgumentException) { } try { col.Add (":"); - Assertion.Fail ("#4"); + Assert.Fail ("#4"); } catch (ArgumentException) { } try { col.Add (" : "); - Assertion.Fail ("#5"); + Assert.Fail ("#5"); } catch (ArgumentException) { } try { col.Add ("XHost: foo"); } catch (ArgumentException) { - Assertion.Fail ("#7"); + Assert.Fail ("#7"); } // invalid values try { col.Add ("XHost" + ((char) 0xa9) + ": foo"); - Assertion.Fail ("#8"); + Assert.Fail ("#8"); } catch (ArgumentException) { } try { col.Add ("XHost: foo" + (char) 0xa9); } catch (ArgumentException) { - Assertion.Fail ("#9"); + Assert.Fail ("#9"); } try { col.Add ("XHost: foo" + (char) 0x7f); - Assertion.Fail ("#10"); + Assert.Fail ("#10"); } catch (ArgumentException) { } @@ -85,12 +85,12 @@ namespace MonoTests.System.Net try { col.Add ("XHost", null); } catch (ArgumentException) { - Assertion.Fail ("#11"); + Assert.Fail ("#11"); } try { col.Add ("XHost:"); } catch (ArgumentException) { - Assertion.Fail ("#12"); + Assert.Fail ("#12"); } // restricted @@ -99,7 +99,7 @@ namespace MonoTests.System.Net try { WebHeaderCollection col2 = new WebHeaderCollection (true); col2.Add ("Host: foo"); - Assertion.Fail ("#13: should fail according to spec"); + Assert.Fail ("#13: should fail according to spec"); } catch (ArgumentException) {} */ } @@ -114,61 +114,61 @@ namespace MonoTests.System.Net w.Add ("Hello", "H3,H4"); string [] sa = w.GetValues ("Hello"); - Assertion.AssertEquals ("#1", 3, sa.Length); - Assertion.AssertEquals ("#2", "H1,H2,H3,H4", w.Get ("Hello")); + Assert.AreEqual (3, sa.Length, "#1"); + Assert.AreEqual ("H1, H2,H3,H4", w.Get ("Hello"), "#2"); w = new WebHeaderCollection (); w.Add ("Accept", "H1"); w.Add ("Accept", "H2"); w.Add ("Accept", "H3,H4"); - Assertion.AssertEquals ("#3a", 3, w.GetValues (0).Length); - Assertion.AssertEquals ("#3b", 4, w.GetValues ("Accept").Length); - Assertion.AssertEquals ("#4", "H1,H2,H3,H4", w.Get ("Accept")); + Assert.AreEqual (3, w.GetValues (0).Length, "#3a"); + Assert.AreEqual (4, w.GetValues ("Accept").Length, "#3b"); + Assert.AreEqual ("H1, H2,H3,H4", w.Get ("Accept"), "#4"); w = new WebHeaderCollection (); w.Add ("Allow", "H1"); w.Add ("Allow", "H2"); w.Add ("Allow", "H3,H4"); sa = w.GetValues ("Allow"); - Assertion.AssertEquals ("#5", 4, sa.Length); - Assertion.AssertEquals ("#6", "H1,H2,H3,H4", w.Get ("Allow")); + Assert.AreEqual (4, sa.Length, "#5"); + Assert.AreEqual ("H1, H2,H3,H4", w.Get ("Allow"), "#6"); w = new WebHeaderCollection (); w.Add ("AUTHorization", "H1, H2, H3"); sa = w.GetValues ("authorization"); - Assertion.AssertEquals ("#9", 3, sa.Length); + Assert.AreEqual (3, sa.Length, "#9"); w = new WebHeaderCollection (); w.Add ("proxy-authenticate", "H1, H2, H3"); sa = w.GetValues ("Proxy-Authenticate"); - Assertion.AssertEquals ("#9", 3, sa.Length); + Assert.AreEqual (3, sa.Length, "#9"); w = new WebHeaderCollection (); w.Add ("expect", "H1,\tH2, H3 "); sa = w.GetValues ("EXPECT"); - Assertion.AssertEquals ("#10", 3, sa.Length); - Assertion.AssertEquals ("#11", "H2", sa [1]); - Assertion.AssertEquals ("#12", "H3", sa [2]); + Assert.AreEqual (3, sa.Length, "#10"); + Assert.AreEqual ("H2", sa [1], "#11"); + Assert.AreEqual ("H3", sa [2], "#12"); try { w.GetValues (null); - Assertion.Fail ("#13"); + Assert.Fail ("#13"); } catch (ArgumentNullException) { } - Assertion.AssertEquals ("#14", null, w.GetValues ("")); - Assertion.AssertEquals ("#15", null, w.GetValues ("NotExistent")); + Assert.AreEqual (null, w.GetValues (""), "#14"); + Assert.AreEqual (null, w.GetValues ("NotExistent"), "#15"); } [Test] public void Indexers () { #if NET_2_0 - Assertion.AssertEquals ("#1.1", "Value1", ((NameValueCollection)col)[0]); + Assert.AreEqual ("Value1", ((NameValueCollection)col)[0], "#1.1"); //FIXME: test also HttpRequestHeader and HttpResponseHeader #else - Assertion.AssertEquals ("#1", "Value1", col [0]); + Assert.AreEqual ("Value1", col [0], "#1"); #endif - Assertion.AssertEquals ("#2", "Value1", col ["Name1"]); - Assertion.AssertEquals ("#3", "Value1", col ["NAME1"]); + Assert.AreEqual ("Value1", col ["Name1"], "#2"); + Assert.AreEqual ("Value1", col ["NAME1"], "#3"); } [Test] @@ -176,7 +176,7 @@ namespace MonoTests.System.Net { col.Remove ("Name1"); col.Remove ("NameNotExist"); - Assertion.AssertEquals ("#1", 1, col.Count); + Assert.AreEqual (1, col.Count, "#1"); /* // this can only be tested in namespace System.Net @@ -184,7 +184,7 @@ namespace MonoTests.System.Net WebHeaderCollection col2 = new WebHeaderCollection (true); col2.Add ("Host", "foo"); col2.Remove ("Host"); - Assertion.Fail ("#2: should fail according to spec"); + Assert.Fail ("#2: should fail according to spec"); } catch (ArgumentException) {} */ } @@ -194,19 +194,19 @@ namespace MonoTests.System.Net { col.Add ("Name1", "Value1b"); col.Set ("Name1", "\t X \t"); - Assertion.AssertEquals ("#1", "X", col.Get ("Name1")); + Assert.AreEqual ("X", col.Get ("Name1"), "#1"); } [Test] public void IsRestricted () { - Assertion.Assert ("#1", !WebHeaderCollection.IsRestricted ("Xhost")); - Assertion.Assert ("#2", WebHeaderCollection.IsRestricted ("Host")); - Assertion.Assert ("#3", WebHeaderCollection.IsRestricted ("HOST")); - Assertion.Assert ("#4", WebHeaderCollection.IsRestricted ("Transfer-Encoding")); - Assertion.Assert ("#5", WebHeaderCollection.IsRestricted ("user-agent")); - Assertion.Assert ("#6", WebHeaderCollection.IsRestricted ("accept")); - Assertion.Assert ("#7", !WebHeaderCollection.IsRestricted ("accept-charset")); + Assert.IsTrue (!WebHeaderCollection.IsRestricted ("Xhost"), "#1"); + Assert.IsTrue (WebHeaderCollection.IsRestricted ("Host"), "#2"); + Assert.IsTrue (WebHeaderCollection.IsRestricted ("HOST"), "#3"); + Assert.IsTrue (WebHeaderCollection.IsRestricted ("Transfer-Encoding"), "#4"); + Assert.IsTrue (WebHeaderCollection.IsRestricted ("user-agent"), "#5"); + Assert.IsTrue (WebHeaderCollection.IsRestricted ("accept"), "#6"); + Assert.IsTrue (!WebHeaderCollection.IsRestricted ("accept-charset"), "#7"); } [Test] @@ -215,7 +215,7 @@ namespace MonoTests.System.Net col.Add ("Name1", "Value1b"); col.Add ("Name3", "Value3a\r\n Value3b"); col.Add ("Name4", " Value4 "); - Assertion.AssertEquals ("#1", "Name1: Value1,Value1b\r\nName2: Value2\r\nName3: Value3a\r\n Value3b\r\nName4: Value4\r\n\r\n", col.ToString ()); + Assert.AreEqual ("Name1: Value1,Value1b\r\nName2: Value2\r\nName3: Value3a\r\n Value3b\r\nName4: Value4\r\n\r\n", col.ToString (), "#1"); } [Test] diff --git a/mcs/class/System/Test/System.Net/WebProxyTest.cs b/mcs/class/System/Test/System.Net/WebProxyTest.cs index a73883adff9..49c7bbd7c93 100644 --- a/mcs/class/System/Test/System.Net/WebProxyTest.cs +++ b/mcs/class/System/Test/System.Net/WebProxyTest.cs @@ -29,38 +29,38 @@ namespace MonoTests.System.Net public void Constructors () { WebProxy p = new WebProxy (); - Assertion.Assert ("#1", p.Address == null); - Assertion.AssertEquals ("#2", 0, p.BypassArrayList.Count); - Assertion.AssertEquals ("#3", 0, p.BypassList.Length); - Assertion.AssertEquals ("#4", false, p.BypassProxyOnLocal); + Assert.IsTrue (p.Address == null, "#1"); + Assert.AreEqual (0, p.BypassArrayList.Count, "#2"); + Assert.AreEqual (0, p.BypassList.Length, "#3"); + Assert.AreEqual (false, p.BypassProxyOnLocal, "#4"); try { p.BypassList = null; - Assertion.Fail ("#5 not spec'd, but should follow ms.net implementation"); + Assert.Fail ("#5 not spec'd, but should follow ms.net implementation"); } catch (ArgumentNullException) { } p = new WebProxy ("webserver.com", 8080); - Assertion.AssertEquals ("#6", new Uri ("http://webserver.com:8080/"), p.Address); + Assert.AreEqual (new Uri ("http://webserver.com:8080/"), p.Address, "#6"); p = new WebProxy ("webserver"); - Assertion.AssertEquals ("#7", new Uri ("http://webserver"), p.Address); + Assert.AreEqual (new Uri ("http://webserver"), p.Address, "#7"); p = new WebProxy ("webserver.com"); - Assertion.AssertEquals ("#8", new Uri ("http://webserver.com"), p.Address); + Assert.AreEqual (new Uri ("http://webserver.com"), p.Address, "#8"); p = new WebProxy ("http://webserver.com"); - Assertion.AssertEquals ("#9", new Uri ("http://webserver.com"), p.Address); + Assert.AreEqual (new Uri ("http://webserver.com"), p.Address, "#9"); p = new WebProxy ("file://webserver"); - Assertion.AssertEquals ("#10", new Uri ("file://webserver"), p.Address); + Assert.AreEqual (new Uri ("file://webserver"), p.Address, "#10"); p = new WebProxy ("http://www.contoso.com", true, null, null); - Assertion.AssertEquals ("#11", 0, p.BypassList.Length); - Assertion.AssertEquals ("#12", 0, p.BypassArrayList.Count); + Assert.AreEqual (0, p.BypassList.Length, "#11"); + Assert.AreEqual (0, p.BypassArrayList.Count, "#12"); try { p = new WebProxy ("http://contoso.com", true, new string [] { "?^!@#$%^&}{][" }, null); - Assertion.Fail ("#13: illegal regular expression"); + Assert.Fail ("#13: illegal regular expression"); } catch (ArgumentException) { } } @@ -74,24 +74,24 @@ namespace MonoTests.System.Net WebProxy p = new WebProxy (proxy1, true); p.BypassArrayList.Add ("http://proxy2.contoso.com"); p.BypassArrayList.Add ("http://proxy2.contoso.com"); - Assertion.AssertEquals ("#1", 2, p.BypassList.Length); - Assertion.Assert ("#2", !p.IsBypassed (new Uri ("http://www.google.com"))); - Assertion.Assert ("#3", p.IsBypassed (proxy2)); - Assertion.AssertEquals ("#4", proxy2, p.GetProxy (proxy2)); + Assert.AreEqual (2, p.BypassList.Length, "#1"); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.google.com")), "#2"); + Assert.IsTrue (p.IsBypassed (proxy2), "#3"); + Assert.AreEqual (proxy2, p.GetProxy (proxy2), "#4"); p.BypassArrayList.Add ("?^!@#$%^&}{]["); - Assertion.AssertEquals ("#10", 3, p.BypassList.Length); + Assert.AreEqual (3, p.BypassList.Length, "#10"); try { - Assertion.Assert ("#11", !p.IsBypassed (proxy2)); - Assertion.Assert ("#12", !p.IsBypassed (new Uri ("http://www.x.com"))); - Assertion.AssertEquals ("#13", proxy1, p.GetProxy (proxy2)); + Assert.IsTrue (!p.IsBypassed (proxy2), "#11"); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.x.com")), "#12"); + Assert.AreEqual (proxy1, p.GetProxy (proxy2), "#13"); // hmm... although #11 and #13 succeeded before (#3 resp. #4), // it now fails to bypass, and the IsByPassed and GetProxy // methods do not fail.. so when an illegal regular // expression is added through this property it's ignored. // probably an ms.net bug?? :( } catch (ArgumentException) { - Assertion.Fail ("#15: illegal regular expression"); + Assert.Fail ("#15: illegal regular expression"); } } @@ -104,23 +104,23 @@ namespace MonoTests.System.Net WebProxy p = new WebProxy (proxy1, true); try { p.BypassList = new string [] { "http://proxy2.contoso.com", "?^!@#$%^&}{][" }; - Assertion.Fail ("#1"); + Assert.Fail ("#1"); } catch (ArgumentException) { // weird, this way invalid regex's fail again.. } - Assertion.AssertEquals ("#2", 2, p.BypassList.Length); + Assert.AreEqual (2, p.BypassList.Length, "#2"); // but it did apparenly store the regex's ! p.BypassList = new string [] { "http://www.x.com" }; - Assertion.AssertEquals ("#3", 1, p.BypassList.Length); + Assert.AreEqual (1, p.BypassList.Length, "#3"); try { p.BypassList = null; - Assertion.Fail ("#4"); + Assert.Fail ("#4"); } catch (ArgumentNullException) { } - Assertion.AssertEquals ("#4", 1, p.BypassList.Length); + Assert.AreEqual (1, p.BypassList.Length, "#4"); } [Test] @@ -132,42 +132,42 @@ namespace MonoTests.System.Net public void IsByPassed () { WebProxy p = new WebProxy ("http://proxy.contoso.com", true); - Assertion.Assert ("#1", !p.IsBypassed (new Uri ("http://www.google.com"))); - Assertion.Assert ("#2", p.IsBypassed (new Uri ("http://localhost/index.html"))); - Assertion.Assert ("#3", p.IsBypassed (new Uri ("http://localhost:8080/index.html"))); - Assertion.Assert ("#4", p.IsBypassed (new Uri ("http://loopback:8080/index.html"))); - Assertion.Assert ("#5", p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html"))); - Assertion.Assert ("#6", p.IsBypassed (new Uri ("http://webserver/index.html"))); - Assertion.Assert ("#7", !p.IsBypassed (new Uri ("http://webserver.com/index.html"))); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.google.com")), "#1"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://localhost/index.html")), "#2"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://localhost:8080/index.html")), "#3"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://loopback:8080/index.html")), "#4"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html")), "#5"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://webserver/index.html")), "#6"); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://webserver.com/index.html")), "#7"); p = new WebProxy ("http://proxy.contoso.com", false); - Assertion.Assert ("#11", !p.IsBypassed (new Uri ("http://www.google.com"))); - Assertion.Assert ("#12: lamespec of ms.net", p.IsBypassed (new Uri ("http://localhost/index.html"))); - Assertion.Assert ("#13: lamespec of ms.net", p.IsBypassed (new Uri ("http://localhost:8080/index.html"))); - Assertion.Assert ("#14: lamespec of ms.net", p.IsBypassed (new Uri ("http://loopback:8080/index.html"))); - Assertion.Assert ("#15: lamespec of ms.net", p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html"))); - Assertion.Assert ("#16", !p.IsBypassed (new Uri ("http://webserver/index.html"))); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.google.com")), "#11"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://localhost/index.html")), "#12: lamespec of ms.net"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://localhost:8080/index.html")), "#13: lamespec of ms.net"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://loopback:8080/index.html")), "#14: lamespec of ms.net"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html")), "#15: lamespec of ms.net"); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://webserver/index.html")), "#16"); p.BypassList = new string [] { "google.com", "contoso.com" }; - Assertion.Assert ("#20", p.IsBypassed (new Uri ("http://www.google.com"))); - Assertion.Assert ("#21", p.IsBypassed (new Uri ("http://www.GOOGLE.com"))); - Assertion.Assert ("#22", p.IsBypassed (new Uri ("http://www.contoso.com:8080/foo/bar/index.html"))); - Assertion.Assert ("#23", !p.IsBypassed (new Uri ("http://www.contoso2.com:8080/foo/bar/index.html"))); - Assertion.Assert ("#24", !p.IsBypassed (new Uri ("http://www.foo.com:8080/contoso.com.html"))); + Assert.IsTrue (p.IsBypassed (new Uri ("http://www.google.com")), "#20"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://www.GOOGLE.com")), "#21"); + Assert.IsTrue (p.IsBypassed (new Uri ("http://www.contoso.com:8080/foo/bar/index.html")), "#22"); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.contoso2.com:8080/foo/bar/index.html")), "#23"); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.foo.com:8080/contoso.com.html")), "#24"); p.BypassList = new string [] { "https" }; - Assertion.Assert ("#30", !p.IsBypassed (new Uri ("http://www.google.com"))); - Assertion.Assert ("#31", p.IsBypassed (new Uri ("https://www.google.com"))); + Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.google.com")), "#30"); + Assert.IsTrue (p.IsBypassed (new Uri ("https://www.google.com")), "#31"); } [Test] public void IsByPassed_Address_Null () { WebProxy p = new WebProxy ((Uri) null, false); - Assertion.Assert ("#1", p.IsBypassed (new Uri ("http://www.google.com"))); + Assert.IsTrue (p.IsBypassed (new Uri ("http://www.google.com")), "#1"); p = new WebProxy ((Uri) null, true); - Assertion.Assert ("#2", p.IsBypassed (new Uri ("http://www.google.com"))); + Assert.IsTrue (p.IsBypassed (new Uri ("http://www.google.com")), "#2"); } [Test] @@ -179,7 +179,7 @@ namespace MonoTests.System.Net WebProxy p = new WebProxy ("http://proxy.contoso.com", true); try { p.IsBypassed (null); - Assertion.Fail ("#A1"); + Assert.Fail ("#A1"); #if NET_2_0 } catch (ArgumentNullException ex) { Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2"); @@ -196,7 +196,7 @@ namespace MonoTests.System.Net p = new WebProxy ((Uri) null); try { p.IsBypassed (null); - Assertion.Fail ("#B1"); + Assert.Fail ("#B1"); #if NET_2_0 } catch (ArgumentNullException ex) { Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2"); @@ -213,7 +213,7 @@ namespace MonoTests.System.Net p = new WebProxy ((Uri) null, true); try { p.IsBypassed (null); - Assertion.Fail ("#C1"); + Assert.Fail ("#C1"); #if NET_2_0 } catch (ArgumentNullException ex) { Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#C2"); diff --git a/mcs/class/System/Test/System.Net/WebRequestTest.cs b/mcs/class/System/Test/System.Net/WebRequestTest.cs index 4b5c176e3bd..636a88d19b3 100644 --- a/mcs/class/System/Test/System.Net/WebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/WebRequestTest.cs @@ -202,41 +202,41 @@ namespace MonoTests.System.Net { public void All () { WebRequest req = WebRequest.Create ("http://www.contoso.com"); - Assertion.Assert ("#1", req is HttpWebRequest); + Assert.IsTrue (req is HttpWebRequest, "#1"); req = WebRequest.Create ("https://www.contoso.com"); - Assertion.Assert ("#2", req is HttpWebRequest); + Assert.IsTrue (req is HttpWebRequest, "#2"); req = WebRequest.Create ("file://www.contoso.com"); - Assertion.Assert ("#3", req is FileWebRequest); + Assert.IsTrue (req is FileWebRequest, "#3"); #if NET_2_0 req = WebRequest.Create ("ftp://www.contoso.com"); - Assertion.Assert ("#4", req is FtpWebRequest); + Assert.IsTrue (req is FtpWebRequest, "#4"); #endif WebRequest.RegisterPrefix ("http://www.contoso.com", new TestWebRequestCreator ()); bool ret = WebRequest.RegisterPrefix ("http://WWW.contoso.com", new TestWebRequestCreator ()); - Assertion.AssertEquals ("#5a", false, ret); + Assert.AreEqual (false, ret, "#5a"); ret = WebRequest.RegisterPrefix ("http://www.contoso.com/foo/bar", new TestWebRequestCreator2 ()); - Assertion.AssertEquals ("#5b", true, ret); + Assert.AreEqual (true, ret, "#5b"); ret = WebRequest.RegisterPrefix ("http://www", new TestWebRequestCreator3 ()); - Assertion.AssertEquals ("#5c", true, ret); + Assert.AreEqual (true, ret, "#5c"); req = WebRequest.Create ("http://WWW.contoso.com"); - Assertion.Assert ("#6", req is TestWebRequest); + Assert.IsTrue (req is TestWebRequest, "#6"); req = WebRequest.Create ("http://WWW.contoso.com/foo/bar/index.html"); - Assertion.Assert ("#7", req is TestWebRequest2); + Assert.IsTrue (req is TestWebRequest2, "#7"); req = WebRequest.Create ("http://WWW.x.com"); - Assertion.Assert ("#8", req is TestWebRequest3); + Assert.IsTrue (req is TestWebRequest3, "#8"); req = WebRequest.Create ("http://WWW.c"); - Assertion.Assert ("#9", req is TestWebRequest3); + Assert.IsTrue (req is TestWebRequest3, "#9"); req = WebRequest.CreateDefault (new Uri("http://WWW.contoso.com")); - Assertion.Assert ("#10", req is HttpWebRequest); + Assert.IsTrue (req is HttpWebRequest, "#10"); try { req = WebRequest.Create ("tcp://www.contoso.com"); - Assertion.Fail ("#11 should have failed with NotSupportedException"); + Assert.Fail ("#11 should have failed with NotSupportedException"); } catch (NotSupportedException) { } } -- 2.25.1