// // ServiceDescriptionReflectorTest.cs // // Author: // Gert Driesen // // Copyright (C) 2006 Novell, Inc. // using NUnit.Framework; using System; using System.Globalization; using System.IO; using System.Web.Services; using System.Web.Services.Description; using System.Xml.Serialization; namespace MonoTests.System.Web.Services.Description { [TestFixture] public class ServiceDescriptionReflectorTest { [Test] [Category ("NotWorking")] public void IncludeTest () { ServiceDescriptionReflector reflector = new ServiceDescriptionReflector (); reflector.Reflect (typeof (IncludeTestServices), "http://localhost/IncludeTestServices.asmx"); Assert.AreEqual (0, reflector.Schemas.Count, "#1"); Assert.AreEqual (1, reflector.ServiceDescriptions.Count, "#2"); ServiceDescription sd = reflector.ServiceDescriptions[0]; Assert.IsNull (sd.Name, "#3"); Assert.AreEqual (1, sd.Types.Schemas.Count, "#4"); StringWriter sw = new StringWriter (); sd.Write (sw); Assert.AreEqual (string.Format(CultureInfo.InvariantCulture, "{0}" + #if NET_2_0 "{0}" + #else "{0}" + #endif " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + #if NET_2_0 " {0}" + #else " {0}" + #endif " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + #if NET_2_0 " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + " {0}" + #endif " {0}" + #if ONLY_1_1 " {0}" + #endif " {0}" + " {0}" + " {0}" + #if NET_2_0 " {0}" + " {0}" + " {0}" + #endif " {0}" + "", Environment.NewLine), sw.ToString (), "#5"); } public class IncludeTestServices : WebService { [WebMethod ()] [return: XmlElement ("MyTime", DataType = "time")] public DateTime EchoString ([XmlElement (DataType = "string")] string strval) { return DateTime.Now; } [WebMethod ()] [XmlInclude (typeof (Car))] public Vehicle Vehicle (string licenseNumber) { if (licenseNumber == "0") { Vehicle v = new Car (); v.licenseNumber = licenseNumber; return v; } else { return null; } } } [XmlRoot ("NewVehicle")] public abstract class Vehicle { public string licenseNumber; public DateTime make; public TimeSpan age; } public class Car : Vehicle { } } }