* WebServiceTest.cs, client/external/BankCodeEJBHomeTest.cs,
authorLluis Sanchez <lluis@novell.com>
Thu, 1 Jul 2004 14:04:31 +0000 (14:04 -0000)
committerLluis Sanchez <lluis@novell.com>
Thu, 1 Jul 2004 14:04:31 +0000 (14:04 -0000)
  client/external/GlobalWeatherTest.cs, client/external/HPcatalogTest.cs,
  client/external/IODCODESPOSTAUXTest.cs,
  client/external/TemperatureServiceTest.cs,
  client/localhost/DataServiceTest.cs,
  client/localhost/DuplicateArrayTestTest.cs,
  client/localhost/IncludeTestTest.cs,
  client/localhost/TestBinding4Test.cs: Use new nunit 2.2 api.

* server/ConvDocLitWra.asmx, server/ConvDocEncWra.asmx,
  server/ConvDocLitBar.asmx, server/ConvDocLitWra.asmx,
  server/ConvRpc.asmx,

* wstest.cs: Added support for generating tests cases from a template.
  Useful to test the same case in all formats and protocols.

* proxies.net.xml.gz, wsdlfiles.tar.gz: Updated.

* client/localhost/ConvDocEncBarTest.cs,
  client/localhost/ConvDocLitBarTest.cs,
  client/localhost/ConvDocLitWraTest.cs,
  client/localhost/ConvRpcTest.cs,
  client/localhost/ConvDocEncBar.asmx:
  Improved tests. Use new nunit 2.2 api.

* Conv.cs.template: template for ConverterService client tests.

* Conv.asmx.template: template for ConverterService services.

* templates.xml: Configuration file for generating the tests.

svn path=/trunk/mcs/; revision=30621

29 files changed:
mcs/class/System.Web.Services/Test/standalone/ChangeLog
mcs/class/System.Web.Services/Test/standalone/Conv.asmx.template [new file with mode: 0644]
mcs/class/System.Web.Services/Test/standalone/Conv.cs.template [new file with mode: 0644]
mcs/class/System.Web.Services/Test/standalone/Makefile
mcs/class/System.Web.Services/Test/standalone/WebServiceTest.cs
mcs/class/System.Web.Services/Test/standalone/client/external/BankCodeEJBHomeTest.cs
mcs/class/System.Web.Services/Test/standalone/client/external/GlobalWeatherTest.cs
mcs/class/System.Web.Services/Test/standalone/client/external/HPcatalogTest.cs
mcs/class/System.Web.Services/Test/standalone/client/external/IODCODESPOSTAUXTest.cs
mcs/class/System.Web.Services/Test/standalone/client/external/TemperatureServiceTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncBarTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncWraTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitBarTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitWraTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvRpcTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/DataServiceTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/DuplicateArrayTestTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/IncludeTestTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/SessionCounterTest.cs
mcs/class/System.Web.Services/Test/standalone/client/localhost/TestBinding4Test.cs
mcs/class/System.Web.Services/Test/standalone/header.html [new file with mode: 0644]
mcs/class/System.Web.Services/Test/standalone/proxies.net.xml.gz
mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncBar.asmx
mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncWra.asmx
mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitBar.asmx
mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitWra.asmx
mcs/class/System.Web.Services/Test/standalone/server/ConvRpc.asmx
mcs/class/System.Web.Services/Test/standalone/wsdlfiles.tar.gz
mcs/class/System.Web.Services/Test/standalone/wstest.cs

index 0622988e0fba4d3f282dd7389607b4e8c7740ab8..073b5c4032238ce0ec92dc5a6e5b6af7f7fdb66f 100644 (file)
@@ -1,3 +1,36 @@
+2004-07-01  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * WebServiceTest.cs, client/external/BankCodeEJBHomeTest.cs, 
+         client/external/GlobalWeatherTest.cs, client/external/HPcatalogTest.cs,
+         client/external/IODCODESPOSTAUXTest.cs, 
+         client/external/TemperatureServiceTest.cs,
+         client/localhost/DataServiceTest.cs, 
+         client/localhost/DuplicateArrayTestTest.cs, 
+         client/localhost/IncludeTestTest.cs,
+         client/localhost/TestBinding4Test.cs: Use new nunit 2.2 api.
+
+       * server/ConvDocLitWra.asmx, server/ConvDocEncWra.asmx, 
+         server/ConvDocLitBar.asmx, server/ConvDocLitWra.asmx,
+         server/ConvRpc.asmx, 
+         
+       * wstest.cs: Added support for generating tests cases from a template.
+         Useful to test the same case in all formats and protocols.
+         
+       * proxies.net.xml.gz, wsdlfiles.tar.gz: Updated.
+       
+       * client/localhost/ConvDocEncBarTest.cs, 
+         client/localhost/ConvDocLitBarTest.cs, 
+         client/localhost/ConvDocLitWraTest.cs,
+         client/localhost/ConvRpcTest.cs,
+         client/localhost/ConvDocEncBar.asmx:
+         Improved tests. Use new nunit 2.2 api. 
+         
+       * Conv.cs.template: template for ConverterService client tests.
+       
+       * Conv.asmx.template: template for ConverterService services.
+       
+       * templates.xml: Configuration file for generating the tests.
+
 2004-06-22  Lluis Sanchez Gual  <lluis@ximian.com>
 
        * proxies.net.xml.gz: Updated.
diff --git a/mcs/class/System.Web.Services/Test/standalone/Conv.asmx.template b/mcs/class/System.Web.Services/Test/standalone/Conv.asmx.template
new file mode 100644 (file)
index 0000000..17edd02
--- /dev/null
@@ -0,0 +1,168 @@
+<%@ WebService Language="c#" Codebehind="ConverterService.asmx.cs" Class="WebServiceTests.ConverterService" %>
+
+/*
+$TEMPLATE_WARNING$
+*/
+
+using System;
+using System.Collections;
+using System.Xml.Serialization;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+using System.Web.Services.Description;
+
+namespace WebServiceTests
+{
+       public class UserInfo : SoapHeader 
+       {
+               public int userId;
+       }
+       
+       public class CurrencyInfo
+       {
+               public CurrencyInfo ()
+               {
+               }
+
+               public CurrencyInfo (string name, double rate) 
+               {
+                       Name = name;
+                       Rate = rate;
+               }
+               
+               public string Name;
+               public double Rate;
+       }
+       
+       public class Simple
+       {
+               public int Dada;
+       }
+
+       [WebServiceAttribute (Namespace="urn:mono-ws-tests", Description="Web service that can make currency conversions")]
+       $SERVICE_ATTRIBUTE$
+       public class ConverterService : System.Web.Services.WebService
+       {
+               static int userCount = 0;
+               static Hashtable conversionTable;
+               
+               public UserInfo userInfo;
+
+               static ConverterService ()
+               {
+                       conversionTable = new Hashtable ();
+                       InternalSetCurrencyRate ("USD", 1);
+                       InternalSetCurrencyRate ("EUR", 0.883884 );
+                       InternalSetCurrencyRate ("GBP", 0.611817 );
+                       InternalSetCurrencyRate ("JPY", 118.271 );
+                       InternalSetCurrencyRate ("CAD", 1.36338 );
+                       InternalSetCurrencyRate ("AUD", 1.51485 );
+                       InternalSetCurrencyRate ("CHF", 1.36915 );
+                       InternalSetCurrencyRate ("RUR", 30.4300 );
+                       InternalSetCurrencyRate ("CNY", 8.27740 );
+                       InternalSetCurrencyRate ("ZAR", 7.62645 );
+                       InternalSetCurrencyRate ("MXN", 10.5025 );
+               }
+               
+               [WebMethod (Description="Registers the user into the system")]
+               [SoapHeaderAttribute ("userInfo", Direction = SoapHeaderDirection.Out)]
+               public void Login (string a)
+               {
+                       userInfo = new UserInfo ();
+                       userInfo.userId = ++userCount;
+               }
+
+               [WebMethod (Description="Converts an amount from one currency to another currency")]
+               [SoapHeaderAttribute ("userInfo")]
+               public double Convert (string sourceCurrency, string targetCurrency, double value)
+               {
+                       CheckUser ();
+                       double usd = (1 / GetCurrencyRate (sourceCurrency)) * value;
+                       return usd * GetCurrencyRate (targetCurrency);
+               }
+               
+               [WebMethod (Description="Returns a list of currency rates")]
+               [SoapHeaderAttribute ("userInfo")]
+               public CurrencyInfo[] GetCurrencyInfo ()
+               {
+                       CheckUser ();
+                       
+                       lock (conversionTable)
+                       {
+                               CurrencyInfo[] info = new CurrencyInfo[conversionTable.Count];
+                               int n = 0;
+                               foreach (CurrencyInfo cinfo in conversionTable.Values)
+                                       info [n++] = cinfo;
+                               return info;
+                       }
+               }
+               
+               [WebMethod (Description="Sets the rate of a currency")]
+               [SoapHeaderAttribute ("userInfo")]
+               public void SetCurrencyRate (string currency, double rate)
+               {
+                       CheckUser ();
+                       InternalSetCurrencyRate (currency, rate);
+               }
+
+               static void InternalSetCurrencyRate (string currency, double rate)
+               {
+                       lock (conversionTable)
+                       {
+                               conversionTable [currency] = new CurrencyInfo (currency, rate);
+                       }
+               }
+
+               [WebMethod (Description="Returns the rate of a currency")]
+               [SoapHeaderAttribute ("userInfo")]
+               public double GetCurrencyRate ([XmlElement(DataType="Name")]string cname)
+               {
+                       CheckUser ();
+                       lock (conversionTable)
+                       {
+                               if (!conversionTable.ContainsKey (cname))
+                                       throw new SoapException ("Unknown currency '" + cname + "'", SoapException.ServerFaultCode);
+                                       
+                               return ((CurrencyInfo) conversionTable [cname]).Rate;
+                       }
+               }
+               
+               [WebMethod]
+               public void Test (Simple dada1, int dada)
+               {
+                       dada = 1;
+               }
+               
+               [WebMethod (MessageName="Test2")]
+               public void Test (int[] dada2, byte[] dada3, int dada)
+               {
+                       dada = 1;
+               }
+               
+               [WebMethod]
+               public System.Collections.Specialized.StringCollection TestArrays (string[] info, string lang)
+               {
+                       return null;
+               }
+               
+               void CheckUser ()
+               {
+                       if (userInfo == null) 
+                               throw new SoapException ("User not logged", SoapException.ServerFaultCode);
+               }
+               
+               [WebMethod]
+               [return: $XML_ELEMENT$("retret")]
+               public MyInfo GetTestInfo (string s, out string d)
+               {
+                       d = "iii";
+                       return new MyInfo();
+               }
+       }
+
+       public class MyInfo
+       {
+               public int a = 4;
+               public string b = "hi";
+       }
+}
diff --git a/mcs/class/System.Web.Services/Test/standalone/Conv.cs.template b/mcs/class/System.Web.Services/Test/standalone/Conv.cs.template
new file mode 100644 (file)
index 0000000..5d0b374
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
+
+using System;
+using System.Threading;
+using NUnit.Framework;
+using System.Web.Services.Protocols;
+using System.Xml;
+using $PROXY_NAMESPACE$;
+
+namespace Localhost.$TEST_NAMESPACE$
+{
+       [TestFixture]
+       public class ConverterTest: WebServiceTest
+       {
+               [Test]
+               public void TestService ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       cs.Login ("lluis");
+                       cs.SetCurrencyRate ("EUR", 0.5);
+                       Assert.AreEqual (0.5, cs.GetCurrencyRate ("EUR"), "#1");
+                       
+                       double res = cs.Convert ("EUR","USD",6);
+                       Assert.AreEqual ((int)res, (int)12, "#2");
+                       
+                       CurrencyInfo[] infos = cs.GetCurrencyInfo ();
+                       Assert.IsNotNull (infos, "infos");
+                       
+                       foreach (CurrencyInfo info in infos)
+                       {
+                               double val = 0;
+                               Assert.IsNotNull (info.Name, "info.Name");
+                               
+                               switch (info.Name)
+                               {
+                                       case "USD": val = 1; break;
+                                       case "EUR": val = 0.5; break;
+                                       case "GBP": val = 0.611817; break;
+                                       case "JPY": val = 118.271; break;
+                                       case "CAD": val = 1.36338; break;
+                                       case "AUD": val = 1.51485; break;
+                                       case "CHF": val = 1.36915; break;
+                                       case "RUR": val = 30.4300; break;
+                                       case "CNY": val = 8.27740; break;
+                                       case "ZAR": val = 7.62645; break;
+                                       case "MXN": val = 10.5025; break;
+                               }
+                               Assert.AreEqual (val, info.Rate, "#3 " + info.Name);
+                       }
+                       cs.SetCurrencyRate ("EUR", 0.9);
+               }
+               
+               // Async tests
+               
+               ConverterService acs;
+               bool a1;
+               bool a2;
+               bool a3;
+               AutoResetEvent eve = new AutoResetEvent (false);
+               
+               [Test]
+               public void AsyncTestService ()
+               {
+                       IAsyncResult ar;
+                       acs = new ConverterService ();
+                       
+                       ar = acs.BeginLogin ("lluis", null, null);
+                       acs.EndLogin (ar);
+                       
+                       acs.BeginSetCurrencyRate ("EUR", 0.5, new AsyncCallback(Callback1), null);
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#0");
+                       Assert.IsTrue (a1, "#1");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#2");
+                       Assert.IsTrue (a2, "#3");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#4");
+                       Assert.IsTrue (a3, "#5");
+               }
+               
+               void Callback1 (IAsyncResult ar)
+               {
+                       acs.EndSetCurrencyRate (ar);
+                       acs.BeginGetCurrencyRate ("EUR", new AsyncCallback(Callback2), null);
+               }
+               
+               void Callback2 (IAsyncResult ar)
+               {
+                       double res = acs.EndGetCurrencyRate (ar);
+                       a1 = (res == 0.5);
+                       eve.Set ();
+                       
+                       acs.BeginConvert ("EUR","USD",6, new AsyncCallback(Callback3), null);
+               }
+               
+               void Callback3 (IAsyncResult ar)
+               {
+                       double res = acs.EndConvert (ar);
+                       a2 = (res == 12);
+                       eve.Set ();
+                       
+                       acs.BeginGetCurrencyInfo (new AsyncCallback(Callback4),null);
+               }
+               
+               void Callback4 (IAsyncResult ar)
+               {
+                       CurrencyInfo[] infos = acs.EndGetCurrencyInfo (ar);
+                       
+                       foreach (CurrencyInfo info in infos)
+                       {
+                               double val = 0;
+                               switch (info.Name)
+                               {
+                                       case "USD": val = 1; break;
+                                       case "EUR": val = 0.5; break;
+                                       case "GBP": val = 0.611817; break;
+                                       case "JPY": val = 118.271; break;
+                                       case "CAD": val = 1.36338; break;
+                                       case "AUD": val = 1.51485; break;
+                                       case "CHF": val = 1.36915; break;
+                                       case "RUR": val = 30.4300; break;
+                                       case "CNY": val = 8.27740; break;
+                                       case "ZAR": val = 7.62645; break;
+                                       case "MXN": val = 10.5025; break;
+                               }
+                               a3 = (val == info.Rate);
+                               if (!a3) break;
+                       }
+                       eve.Set ();
+               }
+               
+               [Test]
+               public void TestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       try
+                       {
+                               cs.SetCurrencyRate ("EUR", 0.5);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void AsyncTestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       IAsyncResult ar = cs.BeginSetCurrencyRate ("EUR", 0.5, null, null);
+                       try
+                       {
+                               cs.EndSetCurrencyRate (ar);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void TestObjectReturn ()
+               {
+                       ConverterServiceExtraTest et = new ConverterServiceExtraTest ();
+                       
+                       // Test the Discover method.
+                       et.Url = "http://localhost:8080/$ASMX_NAME$?disco";
+                       et.Discover ();
+                       
+                       string d;
+                       object res = et.GetTestInfo ("hi", out d);
+                       
+                       Assert.AreEqual ("iii", d, "t1");
+                       Assert.IsNotNull (res, "t2");
+                       Assert.IsTrue (res is XmlNode[], "t3");
+                       XmlNode[] nods = res as XmlNode[];
+                       Assert.AreEqual (5, nods.Length, "t4");
+                       
+                       Assert.IsTrue (nods[0] is XmlAttribute, "t5");
+                       XmlAttribute at = nods[0] as XmlAttribute;
+                       Assert.AreEqual ("id", at.LocalName, "t6");
+                       
+                       Assert.IsTrue (nods[1] is XmlAttribute, "t7");
+                       at = nods[1] as XmlAttribute;
+                       Assert.AreEqual ("type", at.LocalName, "t8");
+                       
+                       Assert.IsTrue (nods[2] is XmlAttribute, "t9");
+                       at = nods[2] as XmlAttribute;
+                       
+                       Assert.IsTrue (nods[3] is XmlElement, "t10");
+                       XmlElement el = nods[3] as XmlElement;
+                       Assert.AreEqual ("a", el.Name, "t11");
+                       
+                       Assert.IsTrue (nods[4] is XmlElement, "t12");
+                       el = nods[4] as XmlElement;
+                       Assert.AreEqual ("b", el.Name, "t13");
+               }               
+       }
+       
+       [System.Web.Services.WebServiceBindingAttribute(Name="ConverterServiceSoap", Namespace="urn:mono-ws-tests")]
+       public class ConverterServiceExtraTest : System.Web.Services.Protocols.SoapHttpClientProtocol
+       {
+               [System.Web.Services.Protocols.$METHOD_ATTRIBUTE$("urn:mono-ws-tests/GetTestInfo", RequestNamespace="urn:mono-ws-tests", ResponseNamespace="urn:mono-ws-tests" $METHOD_ATTRIBUTE_PARAMS$)]
+               public object GetTestInfo(string s, out string d) {
+                       object[] results = this.Invoke("GetTestInfo", new object[] {s});
+                       d = (string) results[1];
+               return ((object)(results[0]));
+               }
+       }
+}
index 030d5702008d1c1847b8189c6bd44285dfc1bd82..a9c8b3eca816c8a555cf8dead709747f6dabda32 100644 (file)
@@ -78,3 +78,6 @@ respage:
        mono transform.exe proxies.diff.xml ../../../../tools/corcompare/mono-api.xsl > proxies.data.html
        cat header.html proxies.data.html > proxies.html
        rm proxies.data.html
+
+genfiles:
+       mono wstest.exe genfiles templates.xml
index 22671e860de5c9d08ae9af836d43ea1d31ca000d..7fd0b215cc7d245a58984d5f70d351101f039c78 100644 (file)
@@ -1,5 +1,5 @@
 using NUnit.Framework;
 
-public class WebServiceTest: Assertion
+public class WebServiceTest
 {
 }
index 58a1c69fbe28df8268c3541f070885ec8ecb4d7c..c0287cebae7c6a2d1341c46de99068b7198e6ebe 100644 (file)
@@ -17,9 +17,9 @@ namespace External.BankCodeEJBHomeTests
                        
                        BankCode bc = new BankCode ();
                        
-                       AssertEquals ("#1", "10020000  ", bc.getCodeByName ("Berlin"));
+                       Assert.AreEqual ("10020000  ", bc.getCodeByName ("Berlin"), "#1");
                        string s = bc.getNameByCode ("10020000  ");
-                       AssertEquals ("#2", "10020000  ", bc.getCodeByName (s));
+                       Assert.AreEqual ("10020000  ", bc.getCodeByName (s), "#2");
                }
        }
 }
index 9fb4e93ae1f3087b71a484f6cb8fd9aa6e4cb418..8e6730000ea008286f582613f75dbe61b4f88762 100644 (file)
@@ -17,25 +17,25 @@ namespace External.GlobalWeatherTests
                {
                        StationInfo si = new StationInfo ();
                        string[] countries = si.listCountries ();
-                       AssertNotNull (countries);
-                       AssertEquals (215, countries.Length);
-                       AssertEquals ("afghanistan", countries[0]);
-                       AssertEquals ("spain", countries[177]);
-                       AssertEquals ("zimbabwe", countries[214]);
+                       Assert.IsNotNull (countries);
+                       Assert.AreEqual (215, countries.Length);
+                       Assert.AreEqual ("afghanistan", countries[0]);
+                       Assert.AreEqual ("spain", countries[177]);
+                       Assert.AreEqual ("zimbabwe", countries[214]);
                        
                        Station[] stations = si.searchByCountry ("spain");
-                       AssertNotNull (stations);
+                       Assert.IsNotNull (stations);
                        foreach (Station sta in stations)
                        {
-                               AssertNotNull (sta);
+                               Assert.IsNotNull (sta);
                                if (sta.icao == "LEBL")
-                                       AssertEquals ("Barcelona / Aeropuerto", sta.name);
+                                       Assert.AreEqual ("Barcelona / Aeropuerto", sta.name);
                        }
                        
                        Station[] st = si.searchByCode ("LEBL");
-                       AssertNotNull (st);
-                       AssertEquals (1, st.Length);
-                       AssertEquals ("Barcelona / Aeropuerto", st[0].name);
+                       Assert.IsNotNull (st);
+                       Assert.AreEqual (1, st.Length);
+                       Assert.AreEqual ("Barcelona / Aeropuerto", st[0].name);
                }
                
                [Test]
@@ -44,9 +44,9 @@ namespace External.GlobalWeatherTests
                        GlobalWeather gw = new GlobalWeather ();
                        WeatherReport wr = gw.getWeatherReport ("LEBL");
                        
-                       AssertNotNull (wr.station);
-                       AssertEquals ("LEBL", wr.station.icao);
-                       AssertEquals ("Barcelona / Aeropuerto", wr.station.name);
+                       Assert.IsNotNull (wr.station);
+                       Assert.AreEqual ("LEBL", wr.station.icao);
+                       Assert.AreEqual ("Barcelona / Aeropuerto", wr.station.name);
                }
        }
 }
index b3727a7d3ed78e3bc1bbad7b496b77e948114c62..41503219a4687ef13ab250a86b5e0523380e56c1 100644 (file)
@@ -18,20 +18,20 @@ namespace External.HPcatalogTests
                        HPcatalogService ser = new HPcatalogService ();
                        string[][] list = ser.getList ("F2444KG");
                        
-                       AssertNotNull (list);
-                       AssertEquals (121, list.Length);
+                       Assert.IsNotNull (list);
+                       Assert.AreEqual (121, list.Length);
                        
                        list = ser.getList ("D5319A");
-                       AssertNotNull (list);
-                       AssertEquals (2, list.Length);
+                       Assert.IsNotNull (list);
+                       Assert.AreEqual (2, list.Length);
                        
-                       AssertNotNull (list[0]);
-                       AssertEquals ("8120-8382", list[0][0]);
-                       AssertEquals ("Power cord (Flint Gray) - 18 AWG, 1.8m (6.0ft) long - Has straight (F) receptacle (For 120V in the USA and Canada)", list[0][1]);
+                       Assert.IsNotNull (list[0]);
+                       Assert.AreEqual ("8120-8382", list[0][0]);
+                       Assert.AreEqual ("Power cord (Flint Gray) - 18 AWG, 1.8m (6.0ft) long - Has straight (F) receptacle (For 120V in the USA and Canada)", list[0][1]);
                        
-                       AssertNotNull (list[1]);
-                       AssertEquals ("5182-8895", list[1][0]);
-                       AssertEquals ("Heat sink support base / retention base - For Pentium II (Klamath) processor", list[1][1]);
+                       Assert.IsNotNull (list[1]);
+                       Assert.AreEqual ("5182-8895", list[1][0]);
+                       Assert.AreEqual ("Heat sink support base / retention base - For Pentium II (Klamath) processor", list[1][1]);
                        
                }
        }
index bf9f33d63084964dc9b151466ea5046b7a69301c..25f8fb4e13ae6e00d05f126b1cdab4dda8dab4e1 100644 (file)
@@ -22,10 +22,10 @@ namespace External.IODCODESPOSTAUXTests
                        Console.WriteLine ("á");
                        Console.WriteLine (res);
                        Console.WriteLine ("Pyrénées Orientales");
-                       AssertEquals ("Pyrénées Orientales", res);
+                       Assert.AreEqual ("Pyrénées Orientales", res);
                        
                        res = ser.GetZipForTown ("Perpignan",",",true);
-                       AssertEquals ("66000=Perpignan,66100=Perpignan", res);
+                       Assert.AreEqual ("66000=Perpignan,66100=Perpignan", res);
                }
        }
 }
index 9da6ae2bc98fa1910a2e6016969afacd3535a2b0..b5ab3513309ed38dc88109391fee1ec62bc88e52 100644 (file)
@@ -17,10 +17,10 @@ namespace External.TemperatureServiceTests
                
                        TemperatureService ts = new TemperatureService ();
                        float temp = ts.getTemp ("95110");
-                       Assert (temp < 140 && temp > -60);
+                       Assert.IsTrue (temp < 140 && temp > -60);
                        
                        temp = ts.getTemp ("hola");
-                       Assert (temp == -999);
+                       Assert.IsTrue (temp == -999);
                }
        }
 }
index ce72f313351fd06fac5e230cfbab15a5862316e7..24ed5cdb53061d49f3dafc47b90a63be265d93fa 100644 (file)
@@ -1,14 +1,19 @@
-// Web service test for WSDL document:
-// http://localhost:8080/ConvDocEncBar.asmx?wsdl
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
 
 using System;
+using System.Threading;
 using NUnit.Framework;
+using System.Web.Services.Protocols;
+using System.Xml;
 using ConvDocEncBarTests.Soap;
 
 namespace Localhost.ConvDocEncBarTests
 {
        [TestFixture]
-       public class ConvDocEncBarTest: WebServiceTest
+       public class ConverterTest: WebServiceTest
        {
                [Test]
                public void TestService ()
@@ -16,17 +21,18 @@ namespace Localhost.ConvDocEncBarTests
                        ConverterService cs = new ConverterService ();
                        cs.Login ("lluis");
                        cs.SetCurrencyRate ("EUR", 0.5);
-                       AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
+                       Assert.AreEqual (0.5, cs.GetCurrencyRate ("EUR"), "#1");
                        
                        double res = cs.Convert ("EUR","USD",6);
-                       AssertEquals ("#2", (int)res, (int)12);
+                       Assert.AreEqual ((int)res, (int)12, "#2");
                        
                        CurrencyInfo[] infos = cs.GetCurrencyInfo ();
-                       AssertNotNull ("infos", infos);
+                       Assert.IsNotNull (infos, "infos");
+                       
                        foreach (CurrencyInfo info in infos)
                        {
                                double val = 0;
-                               AssertNotNull ("info.Name", info.Name);
+                               Assert.IsNotNull (info.Name, "info.Name");
                                
                                switch (info.Name)
                                {
@@ -42,8 +48,171 @@ namespace Localhost.ConvDocEncBarTests
                                        case "ZAR": val = 7.62645; break;
                                        case "MXN": val = 10.5025; break;
                                }
-                               AssertEquals ("#3 " + info.Name, val, info.Rate);
+                               Assert.AreEqual (val, info.Rate, "#3 " + info.Name);
                        }
+                       cs.SetCurrencyRate ("EUR", 0.9);
+               }
+               
+               // Async tests
+               
+               ConverterService acs;
+               bool a1;
+               bool a2;
+               bool a3;
+               AutoResetEvent eve = new AutoResetEvent (false);
+               
+               [Test]
+               public void AsyncTestService ()
+               {
+                       IAsyncResult ar;
+                       acs = new ConverterService ();
+                       
+                       ar = acs.BeginLogin ("lluis", null, null);
+                       acs.EndLogin (ar);
+                       
+                       acs.BeginSetCurrencyRate ("EUR", 0.5, new AsyncCallback(Callback1), null);
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#0");
+                       Assert.IsTrue (a1, "#1");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#2");
+                       Assert.IsTrue (a2, "#3");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#4");
+                       Assert.IsTrue (a3, "#5");
+               }
+               
+               void Callback1 (IAsyncResult ar)
+               {
+                       acs.EndSetCurrencyRate (ar);
+                       acs.BeginGetCurrencyRate ("EUR", new AsyncCallback(Callback2), null);
+               }
+               
+               void Callback2 (IAsyncResult ar)
+               {
+                       double res = acs.EndGetCurrencyRate (ar);
+                       a1 = (res == 0.5);
+                       eve.Set ();
+                       
+                       acs.BeginConvert ("EUR","USD",6, new AsyncCallback(Callback3), null);
+               }
+               
+               void Callback3 (IAsyncResult ar)
+               {
+                       double res = acs.EndConvert (ar);
+                       a2 = (res == 12);
+                       eve.Set ();
+                       
+                       acs.BeginGetCurrencyInfo (new AsyncCallback(Callback4),null);
+               }
+               
+               void Callback4 (IAsyncResult ar)
+               {
+                       CurrencyInfo[] infos = acs.EndGetCurrencyInfo (ar);
+                       
+                       foreach (CurrencyInfo info in infos)
+                       {
+                               double val = 0;
+                               switch (info.Name)
+                               {
+                                       case "USD": val = 1; break;
+                                       case "EUR": val = 0.5; break;
+                                       case "GBP": val = 0.611817; break;
+                                       case "JPY": val = 118.271; break;
+                                       case "CAD": val = 1.36338; break;
+                                       case "AUD": val = 1.51485; break;
+                                       case "CHF": val = 1.36915; break;
+                                       case "RUR": val = 30.4300; break;
+                                       case "CNY": val = 8.27740; break;
+                                       case "ZAR": val = 7.62645; break;
+                                       case "MXN": val = 10.5025; break;
+                               }
+                               a3 = (val == info.Rate);
+                               if (!a3) break;
+                       }
+                       eve.Set ();
+               }
+               
+               [Test]
+               public void TestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       try
+                       {
+                               cs.SetCurrencyRate ("EUR", 0.5);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void AsyncTestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       IAsyncResult ar = cs.BeginSetCurrencyRate ("EUR", 0.5, null, null);
+                       try
+                       {
+                               cs.EndSetCurrencyRate (ar);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void TestObjectReturn ()
+               {
+                       ConverterServiceExtraTest et = new ConverterServiceExtraTest ();
+                       
+                       // Test the Discover method.
+                       et.Url = "http://localhost:8080/ConvDocEncBar.asmx?disco";
+                       et.Discover ();
+                       
+                       string d;
+                       object res = et.GetTestInfo ("hi", out d);
+                       
+                       Assert.AreEqual ("iii", d, "t1");
+                       Assert.IsNotNull (res, "t2");
+                       Assert.IsTrue (res is XmlNode[], "t3");
+                       XmlNode[] nods = res as XmlNode[];
+                       Assert.AreEqual (5, nods.Length, "t4");
+                       
+                       Assert.IsTrue (nods[0] is XmlAttribute, "t5");
+                       XmlAttribute at = nods[0] as XmlAttribute;
+                       Assert.AreEqual ("id", at.LocalName, "t6");
+                       
+                       Assert.IsTrue (nods[1] is XmlAttribute, "t7");
+                       at = nods[1] as XmlAttribute;
+                       Assert.AreEqual ("type", at.LocalName, "t8");
+                       
+                       Assert.IsTrue (nods[2] is XmlAttribute, "t9");
+                       at = nods[2] as XmlAttribute;
+                       
+                       Assert.IsTrue (nods[3] is XmlElement, "t10");
+                       XmlElement el = nods[3] as XmlElement;
+                       Assert.AreEqual ("a", el.Name, "t11");
+                       
+                       Assert.IsTrue (nods[4] is XmlElement, "t12");
+                       el = nods[4] as XmlElement;
+                       Assert.AreEqual ("b", el.Name, "t13");
+               }               
+       }
+       
+       [System.Web.Services.WebServiceBindingAttribute(Name="ConverterServiceSoap", Namespace="urn:mono-ws-tests")]
+       public class ConverterServiceExtraTest : System.Web.Services.Protocols.SoapHttpClientProtocol
+       {
+               [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:mono-ws-tests/GetTestInfo", RequestNamespace="urn:mono-ws-tests", ResponseNamespace="urn:mono-ws-tests" , Use=System.Web.Services.Description.SoapBindingUse.Encoded, ParameterStyle=SoapParameterStyle.Bare)]
+               public object GetTestInfo(string s, out string d) {
+                       object[] results = this.Invoke("GetTestInfo", new object[] {s});
+                       d = (string) results[1];
+               return ((object)(results[0]));
                }
        }
 }
index 9952797374649533eaefeda1eae991d3ed156aa2..591a99f4b28edae37856ae42060e2d671e261c86 100644 (file)
@@ -1,14 +1,19 @@
-// Web service test for WSDL document:
-// http://localhost:8080/ConvDocEncWra.asmx?wsdl
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
 
 using System;
+using System.Threading;
 using NUnit.Framework;
+using System.Web.Services.Protocols;
+using System.Xml;
 using ConvDocEncWraTests.Soap;
 
 namespace Localhost.ConvDocEncWraTests
 {
        [TestFixture]
-       public class ConvDocEncWraTest: WebServiceTest
+       public class ConverterTest: WebServiceTest
        {
                [Test]
                public void TestService ()
@@ -16,18 +21,18 @@ namespace Localhost.ConvDocEncWraTests
                        ConverterService cs = new ConverterService ();
                        cs.Login ("lluis");
                        cs.SetCurrencyRate ("EUR", 0.5);
-                       AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
+                       Assert.AreEqual (0.5, cs.GetCurrencyRate ("EUR"), "#1");
                        
                        double res = cs.Convert ("EUR","USD",6);
-                       AssertEquals ("#2", (int)res, (int)12);
+                       Assert.AreEqual ((int)res, (int)12, "#2");
                        
                        CurrencyInfo[] infos = cs.GetCurrencyInfo ();
-                       AssertNotNull ("infos", infos);
+                       Assert.IsNotNull (infos, "infos");
                        
                        foreach (CurrencyInfo info in infos)
                        {
                                double val = 0;
-                               AssertNotNull ("info.Name", info.Name);
+                               Assert.IsNotNull (info.Name, "info.Name");
                                
                                switch (info.Name)
                                {
@@ -43,8 +48,171 @@ namespace Localhost.ConvDocEncWraTests
                                        case "ZAR": val = 7.62645; break;
                                        case "MXN": val = 10.5025; break;
                                }
-                               AssertEquals ("#3 " + info.Name, val, info.Rate);
+                               Assert.AreEqual (val, info.Rate, "#3 " + info.Name);
                        }
+                       cs.SetCurrencyRate ("EUR", 0.9);
+               }
+               
+               // Async tests
+               
+               ConverterService acs;
+               bool a1;
+               bool a2;
+               bool a3;
+               AutoResetEvent eve = new AutoResetEvent (false);
+               
+               [Test]
+               public void AsyncTestService ()
+               {
+                       IAsyncResult ar;
+                       acs = new ConverterService ();
+                       
+                       ar = acs.BeginLogin ("lluis", null, null);
+                       acs.EndLogin (ar);
+                       
+                       acs.BeginSetCurrencyRate ("EUR", 0.5, new AsyncCallback(Callback1), null);
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#0");
+                       Assert.IsTrue (a1, "#1");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#2");
+                       Assert.IsTrue (a2, "#3");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#4");
+                       Assert.IsTrue (a3, "#5");
+               }
+               
+               void Callback1 (IAsyncResult ar)
+               {
+                       acs.EndSetCurrencyRate (ar);
+                       acs.BeginGetCurrencyRate ("EUR", new AsyncCallback(Callback2), null);
+               }
+               
+               void Callback2 (IAsyncResult ar)
+               {
+                       double res = acs.EndGetCurrencyRate (ar);
+                       a1 = (res == 0.5);
+                       eve.Set ();
+                       
+                       acs.BeginConvert ("EUR","USD",6, new AsyncCallback(Callback3), null);
+               }
+               
+               void Callback3 (IAsyncResult ar)
+               {
+                       double res = acs.EndConvert (ar);
+                       a2 = (res == 12);
+                       eve.Set ();
+                       
+                       acs.BeginGetCurrencyInfo (new AsyncCallback(Callback4),null);
+               }
+               
+               void Callback4 (IAsyncResult ar)
+               {
+                       CurrencyInfo[] infos = acs.EndGetCurrencyInfo (ar);
+                       
+                       foreach (CurrencyInfo info in infos)
+                       {
+                               double val = 0;
+                               switch (info.Name)
+                               {
+                                       case "USD": val = 1; break;
+                                       case "EUR": val = 0.5; break;
+                                       case "GBP": val = 0.611817; break;
+                                       case "JPY": val = 118.271; break;
+                                       case "CAD": val = 1.36338; break;
+                                       case "AUD": val = 1.51485; break;
+                                       case "CHF": val = 1.36915; break;
+                                       case "RUR": val = 30.4300; break;
+                                       case "CNY": val = 8.27740; break;
+                                       case "ZAR": val = 7.62645; break;
+                                       case "MXN": val = 10.5025; break;
+                               }
+                               a3 = (val == info.Rate);
+                               if (!a3) break;
+                       }
+                       eve.Set ();
+               }
+               
+               [Test]
+               public void TestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       try
+                       {
+                               cs.SetCurrencyRate ("EUR", 0.5);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void AsyncTestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       IAsyncResult ar = cs.BeginSetCurrencyRate ("EUR", 0.5, null, null);
+                       try
+                       {
+                               cs.EndSetCurrencyRate (ar);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void TestObjectReturn ()
+               {
+                       ConverterServiceExtraTest et = new ConverterServiceExtraTest ();
+                       
+                       // Test the Discover method.
+                       et.Url = "http://localhost:8080/ConvDocEncWra.asmx?disco";
+                       et.Discover ();
+                       
+                       string d;
+                       object res = et.GetTestInfo ("hi", out d);
+                       
+                       Assert.AreEqual ("iii", d, "t1");
+                       Assert.IsNotNull (res, "t2");
+                       Assert.IsTrue (res is XmlNode[], "t3");
+                       XmlNode[] nods = res as XmlNode[];
+                       Assert.AreEqual (5, nods.Length, "t4");
+                       
+                       Assert.IsTrue (nods[0] is XmlAttribute, "t5");
+                       XmlAttribute at = nods[0] as XmlAttribute;
+                       Assert.AreEqual ("id", at.LocalName, "t6");
+                       
+                       Assert.IsTrue (nods[1] is XmlAttribute, "t7");
+                       at = nods[1] as XmlAttribute;
+                       Assert.AreEqual ("type", at.LocalName, "t8");
+                       
+                       Assert.IsTrue (nods[2] is XmlAttribute, "t9");
+                       at = nods[2] as XmlAttribute;
+                       
+                       Assert.IsTrue (nods[3] is XmlElement, "t10");
+                       XmlElement el = nods[3] as XmlElement;
+                       Assert.AreEqual ("a", el.Name, "t11");
+                       
+                       Assert.IsTrue (nods[4] is XmlElement, "t12");
+                       el = nods[4] as XmlElement;
+                       Assert.AreEqual ("b", el.Name, "t13");
+               }               
+       }
+       
+       [System.Web.Services.WebServiceBindingAttribute(Name="ConverterServiceSoap", Namespace="urn:mono-ws-tests")]
+       public class ConverterServiceExtraTest : System.Web.Services.Protocols.SoapHttpClientProtocol
+       {
+               [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:mono-ws-tests/GetTestInfo", RequestNamespace="urn:mono-ws-tests", ResponseNamespace="urn:mono-ws-tests" , Use=System.Web.Services.Description.SoapBindingUse.Encoded, ParameterStyle=SoapParameterStyle.Wrapped)]
+               public object GetTestInfo(string s, out string d) {
+                       object[] results = this.Invoke("GetTestInfo", new object[] {s});
+                       d = (string) results[1];
+               return ((object)(results[0]));
                }
        }
 }
index a7d73c5a6ffd47d8e4c22baad677597544a405b3..f1c65ba63cb02a2d547699be7eb7e342296de78f 100644 (file)
@@ -1,14 +1,19 @@
-// Web service test for WSDL document:
-// http://localhost:8080/ConvDocLitBar.asmx?wsdl
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
 
 using System;
+using System.Threading;
 using NUnit.Framework;
+using System.Web.Services.Protocols;
+using System.Xml;
 using ConvDocLitBarTests.Soap;
 
 namespace Localhost.ConvDocLitBarTests
 {
        [TestFixture]
-       public class ConvDocLitBarTest: WebServiceTest
+       public class ConverterTest: WebServiceTest
        {
                [Test]
                public void TestService ()
@@ -16,15 +21,19 @@ namespace Localhost.ConvDocLitBarTests
                        ConverterService cs = new ConverterService ();
                        cs.Login ("lluis");
                        cs.SetCurrencyRate ("EUR", 0.5);
-                       AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
+                       Assert.AreEqual (0.5, cs.GetCurrencyRate ("EUR"), "#1");
                        
                        double res = cs.Convert ("EUR","USD",6);
-                       AssertEquals ("#2", (int)res, (int)12);
+                       Assert.AreEqual ((int)res, (int)12, "#2");
                        
                        CurrencyInfo[] infos = cs.GetCurrencyInfo ();
+                       Assert.IsNotNull (infos, "infos");
+                       
                        foreach (CurrencyInfo info in infos)
                        {
                                double val = 0;
+                               Assert.IsNotNull (info.Name, "info.Name");
+                               
                                switch (info.Name)
                                {
                                        case "USD": val = 1; break;
@@ -39,8 +48,171 @@ namespace Localhost.ConvDocLitBarTests
                                        case "ZAR": val = 7.62645; break;
                                        case "MXN": val = 10.5025; break;
                                }
-                               AssertEquals ("#3 " + info.Name, val, info.Rate);
+                               Assert.AreEqual (val, info.Rate, "#3 " + info.Name);
                        }
+                       cs.SetCurrencyRate ("EUR", 0.9);
+               }
+               
+               // Async tests
+               
+               ConverterService acs;
+               bool a1;
+               bool a2;
+               bool a3;
+               AutoResetEvent eve = new AutoResetEvent (false);
+               
+               [Test]
+               public void AsyncTestService ()
+               {
+                       IAsyncResult ar;
+                       acs = new ConverterService ();
+                       
+                       ar = acs.BeginLogin ("lluis", null, null);
+                       acs.EndLogin (ar);
+                       
+                       acs.BeginSetCurrencyRate ("EUR", 0.5, new AsyncCallback(Callback1), null);
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#0");
+                       Assert.IsTrue (a1, "#1");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#2");
+                       Assert.IsTrue (a2, "#3");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#4");
+                       Assert.IsTrue (a3, "#5");
+               }
+               
+               void Callback1 (IAsyncResult ar)
+               {
+                       acs.EndSetCurrencyRate (ar);
+                       acs.BeginGetCurrencyRate ("EUR", new AsyncCallback(Callback2), null);
+               }
+               
+               void Callback2 (IAsyncResult ar)
+               {
+                       double res = acs.EndGetCurrencyRate (ar);
+                       a1 = (res == 0.5);
+                       eve.Set ();
+                       
+                       acs.BeginConvert ("EUR","USD",6, new AsyncCallback(Callback3), null);
+               }
+               
+               void Callback3 (IAsyncResult ar)
+               {
+                       double res = acs.EndConvert (ar);
+                       a2 = (res == 12);
+                       eve.Set ();
+                       
+                       acs.BeginGetCurrencyInfo (new AsyncCallback(Callback4),null);
+               }
+               
+               void Callback4 (IAsyncResult ar)
+               {
+                       CurrencyInfo[] infos = acs.EndGetCurrencyInfo (ar);
+                       
+                       foreach (CurrencyInfo info in infos)
+                       {
+                               double val = 0;
+                               switch (info.Name)
+                               {
+                                       case "USD": val = 1; break;
+                                       case "EUR": val = 0.5; break;
+                                       case "GBP": val = 0.611817; break;
+                                       case "JPY": val = 118.271; break;
+                                       case "CAD": val = 1.36338; break;
+                                       case "AUD": val = 1.51485; break;
+                                       case "CHF": val = 1.36915; break;
+                                       case "RUR": val = 30.4300; break;
+                                       case "CNY": val = 8.27740; break;
+                                       case "ZAR": val = 7.62645; break;
+                                       case "MXN": val = 10.5025; break;
+                               }
+                               a3 = (val == info.Rate);
+                               if (!a3) break;
+                       }
+                       eve.Set ();
+               }
+               
+               [Test]
+               public void TestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       try
+                       {
+                               cs.SetCurrencyRate ("EUR", 0.5);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void AsyncTestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       IAsyncResult ar = cs.BeginSetCurrencyRate ("EUR", 0.5, null, null);
+                       try
+                       {
+                               cs.EndSetCurrencyRate (ar);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void TestObjectReturn ()
+               {
+                       ConverterServiceExtraTest et = new ConverterServiceExtraTest ();
+                       
+                       // Test the Discover method.
+                       et.Url = "http://localhost:8080/ConvDocLitBar.asmx?disco";
+                       et.Discover ();
+                       
+                       string d;
+                       object res = et.GetTestInfo ("hi", out d);
+                       
+                       Assert.AreEqual ("iii", d, "t1");
+                       Assert.IsNotNull (res, "t2");
+                       Assert.IsTrue (res is XmlNode[], "t3");
+                       XmlNode[] nods = res as XmlNode[];
+                       Assert.AreEqual (5, nods.Length, "t4");
+                       
+                       Assert.IsTrue (nods[0] is XmlAttribute, "t5");
+                       XmlAttribute at = nods[0] as XmlAttribute;
+                       Assert.AreEqual ("id", at.LocalName, "t6");
+                       
+                       Assert.IsTrue (nods[1] is XmlAttribute, "t7");
+                       at = nods[1] as XmlAttribute;
+                       Assert.AreEqual ("type", at.LocalName, "t8");
+                       
+                       Assert.IsTrue (nods[2] is XmlAttribute, "t9");
+                       at = nods[2] as XmlAttribute;
+                       
+                       Assert.IsTrue (nods[3] is XmlElement, "t10");
+                       XmlElement el = nods[3] as XmlElement;
+                       Assert.AreEqual ("a", el.Name, "t11");
+                       
+                       Assert.IsTrue (nods[4] is XmlElement, "t12");
+                       el = nods[4] as XmlElement;
+                       Assert.AreEqual ("b", el.Name, "t13");
+               }               
+       }
+       
+       [System.Web.Services.WebServiceBindingAttribute(Name="ConverterServiceSoap", Namespace="urn:mono-ws-tests")]
+       public class ConverterServiceExtraTest : System.Web.Services.Protocols.SoapHttpClientProtocol
+       {
+               [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:mono-ws-tests/GetTestInfo", RequestNamespace="urn:mono-ws-tests", ResponseNamespace="urn:mono-ws-tests" , Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Bare)]
+               public object GetTestInfo(string s, out string d) {
+                       object[] results = this.Invoke("GetTestInfo", new object[] {s});
+                       d = (string) results[1];
+               return ((object)(results[0]));
                }
        }
 }
index 31e8ec26a88df84fb2361eb8b3936111d55659a9..99f89da766cfaa878ab8dd85d3a3226a08215a13 100644 (file)
@@ -1,37 +1,39 @@
-// Web service test for WSDL document:
-// http://localhost:8080/ConvDocLitWra.asmx?wsdl
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
 
 using System;
 using System.Threading;
 using NUnit.Framework;
-using ConvDocLitWraTests.Soap;
 using System.Web.Services.Protocols;
+using System.Xml;
+using ConvDocLitWraTests.Soap;
 
 namespace Localhost.ConvDocLitWraTests
 {
        [TestFixture]
-       public class ConvDocLitWraTest: WebServiceTest
+       public class ConverterTest: WebServiceTest
        {
                [Test]
                public void TestService ()
                {
                        ConverterService cs = new ConverterService ();
-                       
-                       // Test the Discover method.
-                       cs.Url = "http://localhost:8080/ConvDocLitWra.asmx?disco";
-                       cs.Discover ();
-                       
                        cs.Login ("lluis");
                        cs.SetCurrencyRate ("EUR", 0.5);
-                       AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
+                       Assert.AreEqual (0.5, cs.GetCurrencyRate ("EUR"), "#1");
                        
                        double res = cs.Convert ("EUR","USD",6);
-                       AssertEquals ("#2", (int)res, (int)12);
+                       Assert.AreEqual ((int)res, (int)12, "#2");
                        
                        CurrencyInfo[] infos = cs.GetCurrencyInfo ();
+                       Assert.IsNotNull (infos, "infos");
+                       
                        foreach (CurrencyInfo info in infos)
                        {
                                double val = 0;
+                               Assert.IsNotNull (info.Name, "info.Name");
+                               
                                switch (info.Name)
                                {
                                        case "USD": val = 1; break;
@@ -46,7 +48,7 @@ namespace Localhost.ConvDocLitWraTests
                                        case "ZAR": val = 7.62645; break;
                                        case "MXN": val = 10.5025; break;
                                }
-                               AssertEquals ("#3 " + info.Name, val, info.Rate);
+                               Assert.AreEqual (val, info.Rate, "#3 " + info.Name);
                        }
                        cs.SetCurrencyRate ("EUR", 0.9);
                }
@@ -70,14 +72,14 @@ namespace Localhost.ConvDocLitWraTests
                        
                        acs.BeginSetCurrencyRate ("EUR", 0.5, new AsyncCallback(Callback1), null);
                        
-                       Assert ("#0", eve.WaitOne (5000, false));
-                       Assert ("#1",a1);
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#0");
+                       Assert.IsTrue (a1, "#1");
                        
-                       Assert ("#2", eve.WaitOne (5000, false));
-                       Assert ("#3",a2);
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#2");
+                       Assert.IsTrue (a2, "#3");
                        
-                       Assert ("#4", eve.WaitOne (5000, false));
-                       Assert ("#5",a3);
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#4");
+                       Assert.IsTrue (a3, "#5");
                }
                
                void Callback1 (IAsyncResult ar)
@@ -138,12 +140,12 @@ namespace Localhost.ConvDocLitWraTests
                        try
                        {
                                cs.SetCurrencyRate ("EUR", 0.5);
-                               Assert ("#0",false);
+                               Assert.Fail ("#0");
                        }
                        catch (SoapException ex)
                        {
-                               Assert ("#1", ex.Message.IndexOf ("User not logged") != -1);
-                               AssertEquals ("#2", SoapException.ServerFaultCode, ex.Code);
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
                        }
                }
                
@@ -155,13 +157,62 @@ namespace Localhost.ConvDocLitWraTests
                        try
                        {
                                cs.EndSetCurrencyRate (ar);
-                               Assert ("#0",false);
+                               Assert.Fail ("#0");
                        }
                        catch (SoapException ex)
                        {
-                               Assert ("#1", ex.Message.IndexOf ("User not logged") != -1);
-                               AssertEquals ("#2", SoapException.ServerFaultCode, ex.Code);
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
                        }
                }
+               
+               [Test]
+               public void TestObjectReturn ()
+               {
+                       ConverterServiceExtraTest et = new ConverterServiceExtraTest ();
+                       
+                       // Test the Discover method.
+                       et.Url = "http://localhost:8080/ConvDocLitWra.asmx?disco";
+                       et.Discover ();
+                       
+                       string d;
+                       object res = et.GetTestInfo ("hi", out d);
+                       
+                       Assert.AreEqual ("iii", d, "t1");
+                       Assert.IsNotNull (res, "t2");
+                       Assert.IsTrue (res is XmlNode[], "t3");
+                       XmlNode[] nods = res as XmlNode[];
+                       Assert.AreEqual (5, nods.Length, "t4");
+                       
+                       Assert.IsTrue (nods[0] is XmlAttribute, "t5");
+                       XmlAttribute at = nods[0] as XmlAttribute;
+                       Assert.AreEqual ("id", at.LocalName, "t6");
+                       
+                       Assert.IsTrue (nods[1] is XmlAttribute, "t7");
+                       at = nods[1] as XmlAttribute;
+                       Assert.AreEqual ("type", at.LocalName, "t8");
+                       
+                       Assert.IsTrue (nods[2] is XmlAttribute, "t9");
+                       at = nods[2] as XmlAttribute;
+                       
+                       Assert.IsTrue (nods[3] is XmlElement, "t10");
+                       XmlElement el = nods[3] as XmlElement;
+                       Assert.AreEqual ("a", el.Name, "t11");
+                       
+                       Assert.IsTrue (nods[4] is XmlElement, "t12");
+                       el = nods[4] as XmlElement;
+                       Assert.AreEqual ("b", el.Name, "t13");
+               }               
+       }
+       
+       [System.Web.Services.WebServiceBindingAttribute(Name="ConverterServiceSoap", Namespace="urn:mono-ws-tests")]
+       public class ConverterServiceExtraTest : System.Web.Services.Protocols.SoapHttpClientProtocol
+       {
+               [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:mono-ws-tests/GetTestInfo", RequestNamespace="urn:mono-ws-tests", ResponseNamespace="urn:mono-ws-tests" , Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)]
+               public object GetTestInfo(string s, out string d) {
+                       object[] results = this.Invoke("GetTestInfo", new object[] {s});
+                       d = (string) results[1];
+               return ((object)(results[0]));
+               }
        }
 }
index d7d4ccc63935a05cfde1f45af0a7c218693793dc..54f8f22d9255864dac19b3056f3c40f2ea7a3781 100644 (file)
@@ -1,17 +1,19 @@
-// Web service test for WSDL document:
-// http://localhost:8080/ConvRpc.asmx?wsdl
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
 
 using System;
-using System.Web.Services;
-using System.Xml.Serialization;
-using System.Xml;
+using System.Threading;
 using NUnit.Framework;
+using System.Web.Services.Protocols;
+using System.Xml;
 using ConvRpcTests.Soap;
 
 namespace Localhost.ConvRpcTests
 {
        [TestFixture]
-       public class ConvRpcTest: WebServiceTest
+       public class ConverterTest: WebServiceTest
        {
                [Test]
                public void TestService ()
@@ -19,12 +21,95 @@ namespace Localhost.ConvRpcTests
                        ConverterService cs = new ConverterService ();
                        cs.Login ("lluis");
                        cs.SetCurrencyRate ("EUR", 0.5);
-                       AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
+                       Assert.AreEqual (0.5, cs.GetCurrencyRate ("EUR"), "#1");
                        
                        double res = cs.Convert ("EUR","USD",6);
-                       AssertEquals ("#2", (int)res, (int)12);
+                       Assert.AreEqual ((int)res, (int)12, "#2");
                        
                        CurrencyInfo[] infos = cs.GetCurrencyInfo ();
+                       Assert.IsNotNull (infos, "infos");
+                       
+                       foreach (CurrencyInfo info in infos)
+                       {
+                               double val = 0;
+                               Assert.IsNotNull (info.Name, "info.Name");
+                               
+                               switch (info.Name)
+                               {
+                                       case "USD": val = 1; break;
+                                       case "EUR": val = 0.5; break;
+                                       case "GBP": val = 0.611817; break;
+                                       case "JPY": val = 118.271; break;
+                                       case "CAD": val = 1.36338; break;
+                                       case "AUD": val = 1.51485; break;
+                                       case "CHF": val = 1.36915; break;
+                                       case "RUR": val = 30.4300; break;
+                                       case "CNY": val = 8.27740; break;
+                                       case "ZAR": val = 7.62645; break;
+                                       case "MXN": val = 10.5025; break;
+                               }
+                               Assert.AreEqual (val, info.Rate, "#3 " + info.Name);
+                       }
+                       cs.SetCurrencyRate ("EUR", 0.9);
+               }
+               
+               // Async tests
+               
+               ConverterService acs;
+               bool a1;
+               bool a2;
+               bool a3;
+               AutoResetEvent eve = new AutoResetEvent (false);
+               
+               [Test]
+               public void AsyncTestService ()
+               {
+                       IAsyncResult ar;
+                       acs = new ConverterService ();
+                       
+                       ar = acs.BeginLogin ("lluis", null, null);
+                       acs.EndLogin (ar);
+                       
+                       acs.BeginSetCurrencyRate ("EUR", 0.5, new AsyncCallback(Callback1), null);
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#0");
+                       Assert.IsTrue (a1, "#1");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#2");
+                       Assert.IsTrue (a2, "#3");
+                       
+                       Assert.IsTrue (eve.WaitOne (5000, false), "#4");
+                       Assert.IsTrue (a3, "#5");
+               }
+               
+               void Callback1 (IAsyncResult ar)
+               {
+                       acs.EndSetCurrencyRate (ar);
+                       acs.BeginGetCurrencyRate ("EUR", new AsyncCallback(Callback2), null);
+               }
+               
+               void Callback2 (IAsyncResult ar)
+               {
+                       double res = acs.EndGetCurrencyRate (ar);
+                       a1 = (res == 0.5);
+                       eve.Set ();
+                       
+                       acs.BeginConvert ("EUR","USD",6, new AsyncCallback(Callback3), null);
+               }
+               
+               void Callback3 (IAsyncResult ar)
+               {
+                       double res = acs.EndConvert (ar);
+                       a2 = (res == 12);
+                       eve.Set ();
+                       
+                       acs.BeginGetCurrencyInfo (new AsyncCallback(Callback4),null);
+               }
+               
+               void Callback4 (IAsyncResult ar)
+               {
+                       CurrencyInfo[] infos = acs.EndGetCurrencyInfo (ar);
+                       
                        foreach (CurrencyInfo info in infos)
                        {
                                double val = 0;
@@ -42,7 +127,42 @@ namespace Localhost.ConvRpcTests
                                        case "ZAR": val = 7.62645; break;
                                        case "MXN": val = 10.5025; break;
                                }
-                               AssertEquals ("#3 " + info.Name, val, info.Rate);
+                               a3 = (val == info.Rate);
+                               if (!a3) break;
+                       }
+                       eve.Set ();
+               }
+               
+               [Test]
+               public void TestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       try
+                       {
+                               cs.SetCurrencyRate ("EUR", 0.5);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
+                       }
+               }
+               
+               [Test]
+               public void AsyncTestException ()
+               {
+                       ConverterService cs = new ConverterService ();
+                       IAsyncResult ar = cs.BeginSetCurrencyRate ("EUR", 0.5, null, null);
+                       try
+                       {
+                               cs.EndSetCurrencyRate (ar);
+                               Assert.Fail ("#0");
+                       }
+                       catch (SoapException ex)
+                       {
+                               Assert.IsTrue (ex.Message.IndexOf ("User not logged") != -1, "#1");
+                               Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#2");
                        }
                }
                
@@ -50,44 +170,45 @@ namespace Localhost.ConvRpcTests
                public void TestObjectReturn ()
                {
                        ConverterServiceExtraTest et = new ConverterServiceExtraTest ();
+                       
+                       // Test the Discover method.
+                       et.Url = "http://localhost:8080/ConvRpc.asmx?disco";
+                       et.Discover ();
+                       
                        string d;
                        object res = et.GetTestInfo ("hi", out d);
                        
-                       AssertEquals ("t1", "iii", d);
-                       AssertNotNull ("t2", res);
-                       Assert ("t3", res is XmlNode[]);
+                       Assert.AreEqual ("iii", d, "t1");
+                       Assert.IsNotNull (res, "t2");
+                       Assert.IsTrue (res is XmlNode[], "t3");
                        XmlNode[] nods = res as XmlNode[];
-                       AssertEquals ("t4", 5, nods.Length);
+                       Assert.AreEqual (5, nods.Length, "t4");
                        
-                       Assert ("t5", nods[0] is XmlAttribute);
+                       Assert.IsTrue (nods[0] is XmlAttribute, "t5");
                        XmlAttribute at = nods[0] as XmlAttribute;
-                       AssertEquals ("t6", "id", at.LocalName);
+                       Assert.AreEqual ("id", at.LocalName, "t6");
                        
-                       Assert ("t7", nods[1] is XmlAttribute);
+                       Assert.IsTrue (nods[1] is XmlAttribute, "t7");
                        at = nods[1] as XmlAttribute;
-                       AssertEquals ("t8", "type", at.LocalName);
+                       Assert.AreEqual ("type", at.LocalName, "t8");
                        
-                       Assert ("t9", nods[2] is XmlAttribute);
+                       Assert.IsTrue (nods[2] is XmlAttribute, "t9");
                        at = nods[2] as XmlAttribute;
                        
-                       Assert ("t10", nods[3] is XmlElement);
+                       Assert.IsTrue (nods[3] is XmlElement, "t10");
                        XmlElement el = nods[3] as XmlElement;
-                       AssertEquals ("t11", "a", el.Name);
+                       Assert.AreEqual ("a", el.Name, "t11");
                        
-                       Assert ("t12", nods[4] is XmlElement);
+                       Assert.IsTrue (nods[4] is XmlElement, "t12");
                        el = nods[4] as XmlElement;
-                       AssertEquals ("t13", "b", el.Name);
-               }
+                       Assert.AreEqual ("b", el.Name, "t13");
+               }               
        }
        
        [System.Web.Services.WebServiceBindingAttribute(Name="ConverterServiceSoap", Namespace="urn:mono-ws-tests")]
        public class ConverterServiceExtraTest : System.Web.Services.Protocols.SoapHttpClientProtocol
        {
-               public ConverterServiceExtraTest() {
-                       this.Url = "http://localhost:8080/ConvRpc.asmx";
-               }
-       
-               [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:mono-ws-tests/GetTestInfo", RequestNamespace="urn:mono-ws-tests", ResponseNamespace="urn:mono-ws-tests")]
+               [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:mono-ws-tests/GetTestInfo", RequestNamespace="urn:mono-ws-tests", ResponseNamespace="urn:mono-ws-tests" )]
                public object GetTestInfo(string s, out string d) {
                        object[] results = this.Invoke("GetTestInfo", new object[] {s});
                        d = (string) results[1];
index 3f5e1b0326c4ae4b010e1de08667e4769c988f0e..1b381de3466de3e63ae9fdd1f8edda268a5c6094 100644 (file)
@@ -20,22 +20,22 @@ namespace Localhost.DataServiceTests
                        DataSet dset = service.QueryData ("some query");
                        DataTable t = dset.Tables["PhoneNumbers"];
                        
-                       AssertNotNull ("#1", t);
-                       AssertEquals ("#2", 2, t.Rows.Count);
+                       Assert.IsNotNull (t, "#1");
+                       Assert.AreEqual (2, t.Rows.Count, "#2");
                        
                        DataRow row = t.Rows[0];
-                       AssertEquals ("#3", "Lluis", row["name"]);
-                       AssertEquals ("#4", "23452345", row["home"]);
+                       Assert.AreEqual ("Lluis", row["name"], "#3");
+                       Assert.AreEqual ("23452345", row["home"], "#4");
                        row = t.Rows[1];
-                       AssertEquals ("#5", "Pep", row["name"]);
-                       AssertEquals ("#6", "435345", row["home"]);
+                       Assert.AreEqual ("Pep", row["name"], "#5");
+                       Assert.AreEqual ("435345", row["home"], "#6");
                        
                        DataRow newRow = t.NewRow();
                        newRow["name"] = "Pau";
                        newRow["home"] = "9028374";
                        t.Rows.Add (newRow);
                        int n = service.SaveData (dset);
-                       AssertEquals ("#7", 3, n);
+                       Assert.AreEqual (3, n, "#7");
                }
        }
 }
index 0d9785827d9929701a2d1a1a201053e9d6f18597..0241fa44c08158756e65d8433ed619b1796f2f2d 100644 (file)
@@ -23,20 +23,20 @@ namespace Localhost.DuplicateArrayTestTests
                        correctionsCorrection[] arr = new correctionsCorrection[2]{c,c};
                        arr = s.SpellCheck(ref title,ref url,arr);
                        
-                       AssertEquals ("t1", 2, arr.Length);
+                       Assert.AreEqual (2, arr.Length, "t1");
                        
                        for (int i =0; i< arr.Length ; i++)
                        {
                                c = arr[i];
-                               AssertNotNull ("t2."+i, c);
-                               AssertEquals ("t3."+i, "bye", c.word);
-                               AssertNotNull ("t4."+i, c.suggestions);
-                               AssertEquals ("t5."+i, 2, c.suggestions.Length);
-                               AssertEquals ("t6."+i, "end", c.suggestions[0]);
-                               AssertEquals ("t7."+i, "test", c.suggestions[1]);
+                               Assert.IsNotNull (c, "t2."+i);
+                               Assert.AreEqual ("bye", c.word, "t3."+i);
+                               Assert.IsNotNull (c.suggestions, "t4."+i);
+                               Assert.AreEqual (2, c.suggestions.Length, "t5."+i);
+                               Assert.AreEqual ("end", c.suggestions[0], "t6."+i);
+                               Assert.AreEqual ("test", c.suggestions[1], "t7."+i);
                        }
-                       AssertEquals ("t8", "hello", title);
-                       AssertEquals ("t9", "tmp", url);
+                       Assert.AreEqual ("hello", title, "t8");
+                       Assert.AreEqual ("tmp", url, "t9");
                }
        }
 }
index d8f699192092dbdfc258c7f73c5084b3ba7fb4b4..d35bc5004769d7c67dbc12c48d1e54e34d3b2bfd 100644 (file)
@@ -15,15 +15,15 @@ namespace Localhost.IncludeTestTests
                {
                        IncludeTest test = new IncludeTest();
                        object[] data = test.foo ();
-                       AssertNotNull (data);
+                       Assert.IsNotNull (data);
                        
                        ComplexThing c1 = data[0] as ComplexThing;
-                       AssertNotNull (c1);
-                       AssertEquals ("abc",c1.name);
+                       Assert.IsNotNull (c1);
+                       Assert.AreEqual ("abc",c1.name);
                        
                        ComplexThing c2 = data[1] as ComplexThing;
-                       AssertNotNull (c2);
-                       AssertEquals ("xyz",c2.name);
+                       Assert.IsNotNull (c2);
+                       Assert.AreEqual ("xyz",c2.name);
                }
        }
 }
index d91a77c22a29e65dbc481e819480ea9a6cd8cf8f..45cb4607b43bc5e4df8984cffb31150d3982f773 100644 (file)
@@ -18,7 +18,7 @@ namespace Localhost.SessionCounterTests
                        s.CookieContainer = new CookieContainer ();
                        s.Reset ();
                        for (int n=1; n<10; n++)
-                               AssertEquals ("t"+n, n, s.AddOne ());
+                               Assert.AreEqual (n, s.AddOne (), "t"+n);
                }
        }
 }
index 831079ecb86790f5141836773bb4fd51b656935e..208a1cfa34f546d33521201fc7e77140cb265c78 100644 (file)
@@ -31,19 +31,19 @@ namespace Localhost.TestBinding4Tests
                        nodes = data.GetTabStruct ("hello", nodes);
                        Check ("GetTabStruct", nodes);
                        
-                       Assert ("RebuildTabList 1", data.RebuildTabList (true));
-                       Assert ("RebuildTabList 2", !data.RebuildTabList (false));
+                       Assert.IsTrue (data.RebuildTabList (true), "RebuildTabList 1");
+                       Assert.IsTrue (!data.RebuildTabList (false), "RebuildTabList 2");
                        
-                       Assert ("RebuildTabStruct 1", data.RebuildTabStruct ("a", true));
-                       Assert ("RebuildTabStruct 2", !data.RebuildTabStruct ("b", false));
+                       Assert.IsTrue (data.RebuildTabStruct ("a", true), "RebuildTabStruct 1");
+                       Assert.IsTrue (!data.RebuildTabStruct ("b", false), "RebuildTabStruct 2");
                }
                
                void Check (string met, XmlNode[] nodes)
                {
-                       AssertNotNull (met + " #1", nodes);
-                       AssertEquals (met + " #2", 2, nodes.Length);
-                       AssertEquals (met + " #3", "<one someAtt=\"someValue\" xmlns=\"\" />", nodes[0].OuterXml);
-                       AssertEquals (met + " #4", "<two someAtt=\"someValue\" xmlns=\"\" />", nodes[1].OuterXml);
+                       Assert.IsNotNull (nodes, met + " #1");
+                       Assert.AreEqual (2, nodes.Length, met + " #2");
+                       Assert.AreEqual ("<one someAtt=\"someValue\" xmlns=\"\" />", nodes[0].OuterXml, met + " #3");
+                       Assert.AreEqual ("<two someAtt=\"someValue\" xmlns=\"\" />", nodes[1].OuterXml, met + " #4");
                }
        }
 }
diff --git a/mcs/class/System.Web.Services/Test/standalone/header.html b/mcs/class/System.Web.Services/Test/standalone/header.html
new file mode 100644 (file)
index 0000000..851b376
--- /dev/null
@@ -0,0 +1,7 @@
+<html>
+<head>
+<title>wsdl tests</title>
+<LINK rel="stylesheet" type="text/css" href="cm/cormissing.css">
+<SCRIPT src="cm/cormissing.js"></SCRIPT>
+</head>
+<body bgcolor="#ffffff" text="#000000">
index 18670ece3aee8bf1ab49fc72b8b7392100c90429..14d05989b3c022f42355f40c195ca3ec25c45dc4 100644 (file)
Binary files a/mcs/class/System.Web.Services/Test/standalone/proxies.net.xml.gz and b/mcs/class/System.Web.Services/Test/standalone/proxies.net.xml.gz differ
index 77c54866faa321c32a6948a6586ecdda81d48fb7..ed1f61fe3a7e9c433fb721adcd247f71de48a93f 100644 (file)
@@ -1,5 +1,10 @@
 <%@ WebService Language="c#" Codebehind="ConverterService.asmx.cs" Class="WebServiceTests.ConverterService" %>
 
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
+
 using System;
 using System.Collections;
 using System.Xml.Serialization;
@@ -135,10 +140,30 @@ namespace WebServiceTests
                        dada = 1;
                }
                
+               [WebMethod]
+               public System.Collections.Specialized.StringCollection TestArrays (string[] info, string lang)
+               {
+                       return null;
+               }
+               
                void CheckUser ()
                {
                        if (userInfo == null) 
                                throw new SoapException ("User not logged", SoapException.ServerFaultCode);
                }
+               
+               [WebMethod]
+               [return: SoapElement("retret")]
+               public MyInfo GetTestInfo (string s, out string d)
+               {
+                       d = "iii";
+                       return new MyInfo();
+               }
+       }
+
+       public class MyInfo
+       {
+               public int a = 4;
+               public string b = "hi";
        }
 }
index c43bd67c43e66238eddb048d1d78153f33dafef1..b1c7ff5652b45a6cae315ce43921802abd3de279 100644 (file)
@@ -1,5 +1,10 @@
 <%@ WebService Language="c#" Codebehind="ConverterService.asmx.cs" Class="WebServiceTests.ConverterService" %>
 
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
+
 using System;
 using System.Collections;
 using System.Xml.Serialization;
@@ -136,7 +141,7 @@ namespace WebServiceTests
                }
                
                [WebMethod]
-               public  System.Collections.Specialized.StringCollection TestArrays (string[] info, string lang)
+               public System.Collections.Specialized.StringCollection TestArrays (string[] info, string lang)
                {
                        return null;
                }
@@ -146,5 +151,19 @@ namespace WebServiceTests
                        if (userInfo == null) 
                                throw new SoapException ("User not logged", SoapException.ServerFaultCode);
                }
+               
+               [WebMethod]
+               [return: SoapElement("retret")]
+               public MyInfo GetTestInfo (string s, out string d)
+               {
+                       d = "iii";
+                       return new MyInfo();
+               }
+       }
+
+       public class MyInfo
+       {
+               public int a = 4;
+               public string b = "hi";
        }
 }
index 660995713d80039333c959e7f8d0f9e5f6ebbb8f..7973580335a42d91dbf832b38e9307898f8191f3 100644 (file)
@@ -1,5 +1,10 @@
 <%@ WebService Language="c#" Codebehind="ConverterService.asmx.cs" Class="WebServiceTests.ConverterService" %>
 
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
+
 using System;
 using System.Collections;
 using System.Xml.Serialization;
@@ -37,7 +42,7 @@ namespace WebServiceTests
 
        [WebServiceAttribute (Namespace="urn:mono-ws-tests", Description="Web service that can make currency conversions")]
        [SoapDocumentServiceAttribute (Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Bare)]
-       public class ConverterService
+       public class ConverterService : System.Web.Services.WebService
        {
                static int userCount = 0;
                static Hashtable conversionTable;
@@ -135,10 +140,30 @@ namespace WebServiceTests
                        dada = 1;
                }
                
+               [WebMethod]
+               public System.Collections.Specialized.StringCollection TestArrays (string[] info, string lang)
+               {
+                       return null;
+               }
+               
                void CheckUser ()
                {
                        if (userInfo == null) 
                                throw new SoapException ("User not logged", SoapException.ServerFaultCode);
                }
+               
+               [WebMethod]
+               [return: XmlElement("retret")]
+               public MyInfo GetTestInfo (string s, out string d)
+               {
+                       d = "iii";
+                       return new MyInfo();
+               }
+       }
+
+       public class MyInfo
+       {
+               public int a = 4;
+               public string b = "hi";
        }
 }
index 8c5dadf59cbc68311be9069097f9a874e822290c..d0beee6f093e463eb65b109722f17cfb6b318db1 100644 (file)
@@ -1,5 +1,10 @@
 <%@ WebService Language="c#" Codebehind="ConverterService.asmx.cs" Class="WebServiceTests.ConverterService" %>
 
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
+
 using System;
 using System.Collections;
 using System.Xml.Serialization;
@@ -136,7 +141,7 @@ namespace WebServiceTests
                }
                
                [WebMethod]
-               public  System.Collections.Specialized.StringCollection TestArrays (string[] info, string lang)
+               public System.Collections.Specialized.StringCollection TestArrays (string[] info, string lang)
                {
                        return null;
                }
@@ -146,5 +151,19 @@ namespace WebServiceTests
                        if (userInfo == null) 
                                throw new SoapException ("User not logged", SoapException.ServerFaultCode);
                }
+               
+               [WebMethod]
+               [return: XmlElement("retret")]
+               public MyInfo GetTestInfo (string s, out string d)
+               {
+                       d = "iii";
+                       return new MyInfo();
+               }
+       }
+
+       public class MyInfo
+       {
+               public int a = 4;
+               public string b = "hi";
        }
 }
index 229990859de5fb23389f7e9cb6d38e150ee64db6..d4c3afe91e2ac2beaba6d55114809cab67477969 100644 (file)
@@ -1,5 +1,10 @@
 <%@ WebService Language="c#" Codebehind="ConverterService.asmx.cs" Class="WebServiceTests.ConverterService" %>
 
+/*
+WARNING: This code was generated by a tool.
+Changes to this file will be lost if the code is regenerated
+*/
+
 using System;
 using System.Collections;
 using System.Xml.Serialization;
@@ -36,7 +41,7 @@ namespace WebServiceTests
        }
 
        [WebServiceAttribute (Namespace="urn:mono-ws-tests", Description="Web service that can make currency conversions")]
-       [SoapRpcServiceAttribute ()]
+       [SoapRpcServiceAttribute()]
        public class ConverterService : System.Web.Services.WebService
        {
                static int userCount = 0;
@@ -136,11 +141,9 @@ namespace WebServiceTests
                }
                
                [WebMethod]
-               [return: SoapElement("retret")]
-               public MyInfo GetTestInfo (string s, out string d)
+               public System.Collections.Specialized.StringCollection TestArrays (string[] info, string lang)
                {
-                       d = "iii";
-                       return new MyInfo();
+                       return null;
                }
                
                void CheckUser ()
@@ -148,8 +151,16 @@ namespace WebServiceTests
                        if (userInfo == null) 
                                throw new SoapException ("User not logged", SoapException.ServerFaultCode);
                }
+               
+               [WebMethod]
+               [return: SoapElement("retret")]
+               public MyInfo GetTestInfo (string s, out string d)
+               {
+                       d = "iii";
+                       return new MyInfo();
+               }
        }
-       
+
        public class MyInfo
        {
                public int a = 4;
index 95de76945a8cbc3abd0e7b1e0ba8c20a26cc3db1..ea178ad9e7adf304b3583541951252f4aa851398 100644 (file)
Binary files a/mcs/class/System.Web.Services/Test/standalone/wsdlfiles.tar.gz and b/mcs/class/System.Web.Services/Test/standalone/wsdlfiles.tar.gz differ
index 9e6e8982048eb5cd006762c82cf6fc83515c2e71..31c2822b2b481473c6759d5150c7c3b6740cc21a 100644 (file)
@@ -43,7 +43,7 @@ public class Driver
                
                if (args[0] == "gp")
                {
-                       BuildProxies (GetArg (args,1) == "all");
+                       BuildProxies (GetArg (args,1));
                }
                else if (args[0] == "gc")
                {
@@ -73,6 +73,10 @@ public class Driver
                {
                        MsFix (GetArg (args,1));
                }
+               else if (args[0] == "genfiles")
+               {
+                       GenerateFiles (GetArg (args,1));
+               }
                
                SaveInfo ();
                
@@ -478,7 +482,7 @@ public class Driver
                        Console.WriteLine ("{0,-3} {1}", serverCounts[n], serverNames[n]);
        }
 
-       static void BuildProxies (bool buildAll)
+       static void BuildProxies (string host)
        {
                Console.WriteLine ();
                Console.WriteLine ("Generating proxies");
@@ -488,10 +492,15 @@ public class Driver
                XmlElement ele = doc.CreateElement ("errors");
                doc.AppendChild (ele);
                
+               bool buildAll = host == "*";
+               if (buildAll) host = null;
+               
                ArrayList proxies = new ArrayList ();
                
-               foreach (ServiceData fd in services.services)
+               foreach (ServiceData fd in services.services) {
+                       if (host != null && host != new Uri (fd.Wsdl).Host) continue;
                        BuildProxy (fd, buildAll, proxies, ele);
+               }
                
                StreamWriter sw = new StreamWriter (Path.Combine (basePath, "proxies.sources"));
                foreach (string f in proxies)
@@ -761,6 +770,53 @@ public class Driver
                sr.Close ();
        }
        
+       static void GenerateFiles (string templateFile)
+       {
+               XmlDocument doc = new XmlDocument ();
+               doc.Load (templateFile);
+               
+               XmlNodeList targets = doc.SelectNodes ("fileGeneration/targets/target");
+               XmlElement gvarset = (XmlElement) doc.SelectSingleNode ("fileGeneration/vars[@name='_global']");
+               
+               foreach (XmlElement node in targets) {
+                       string tid = node.GetAttribute ("template");
+                       string file = node.GetAttribute ("file");
+                       XmlElement xtemp = (XmlElement) doc.SelectSingleNode ("fileGeneration/templates/template[@id='" + tid + "']");
+                       if (xtemp == null) throw new Exception ("Template " + tid + " not found");
+                       string tempFile = xtemp.GetAttribute ("file");
+                       
+                       StreamReader sr = new StreamReader (tempFile);
+                       string template = sr.ReadToEnd ();
+                       sr.Close ();
+                       
+                       string content = ReplaceVars (template, node);
+                       content = ReplaceVars (content, gvarset);
+                       
+                       StreamWriter sw = new StreamWriter (file);
+                       sw.Write (content);
+                       sw.Close ();
+                       Console.WriteLine ("Writen " + file);
+               }
+       }
+       
+       static string ReplaceVars (string content, XmlElement root)
+       {
+               XmlNodeList nodes = root.SelectNodes ("var");
+               foreach (XmlElement elem in nodes) {
+                       string include = elem.GetAttribute ("include");
+                       if (include != "") {
+                               XmlElement varset = (XmlElement) root.OwnerDocument.SelectSingleNode ("fileGeneration/vars[@name='" + include + "']");
+                               if (varset == null) throw new Exception ("varset '" + include + "' not found");
+                               content = ReplaceVars (content, varset);
+                       }
+                       else {
+                               content = content.Replace ("$" + elem.GetAttribute ("name") + "$", elem.InnerText);
+                       }
+               }
+               
+               return content;
+       }
+       
        static void RegisterFailure (ServiceData sd)
        {
                ServiceStatus status = null;