2007-02-19 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 19 Feb 2007 15:59:21 +0000 (15:59 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Mon, 19 Feb 2007 15:59:21 +0000 (15:59 -0000)
* ServiceDescriptionReflectorTest.cs : added test for methods with
  nullable return type.

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

mcs/class/System.Web.Services/Test/System.Web.Services.Description/ChangeLog
mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionReflectorTest.cs

index 4e20325f23427ab7ac3afea15e983295ded3ea0b..50cf9a86fe7d7f2b63af1eb748d45a7fbdbbfb80 100644 (file)
@@ -1,3 +1,8 @@
+2007-02-19  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ServiceDescriptionReflectorTest.cs : added test for methods with
+         nullable return type.
+
 2007-01-19  Atsushi Enomoto  <atsushi@ximian.com>
 
        * ServiceDescriptionImporterTest.cs : new test.
index 93438a15715525bff75fb0b1f7bf5299cdc4dd96..25f8d34ac12d9cdd045e8c6ef7c017b24cb05624 100644 (file)
@@ -3,7 +3,9 @@
 //
 // Author:
 //     Gert Driesen  <drieseng@users.sourceforge.net>
+//     Atsushi Enomoto  <atsushi@ximian.com>
 //
+// Copyright (C) 2007 Gert Driesen
 // Copyright (C) 2006 Novell, Inc.
 //
 
@@ -14,6 +16,7 @@ using System.Globalization;
 using System.IO;
 using System.Web.Services;
 using System.Web.Services.Description;
+using System.Xml.Schema;
 using System.Xml.Serialization;
 
 namespace MonoTests.System.Web.Services.Description
@@ -21,6 +24,29 @@ namespace MonoTests.System.Web.Services.Description
        [TestFixture]
        public class ServiceDescriptionReflectorTest
        {
+#if NET_2_0
+               [Test]
+               public void ReflectNullableInt ()
+               {
+                       ServiceDescriptionReflector r =
+                               new ServiceDescriptionReflector ();
+                       r.Reflect (typeof (NullableContainer), null);
+                       ServiceDescription sd = r.ServiceDescriptions [0];
+                       XmlSchema xs = sd.Types.Schemas [0];
+                       XmlSchemaElement el = null;
+                       foreach (XmlSchemaElement e in xs.Items) {
+                               if (e.Name != "GetNullResponse")
+                                       continue;
+                               el = e;
+                               break;
+                       }
+                       XmlSchemaComplexType ct =
+                               el.SchemaType as XmlSchemaComplexType;
+                       XmlSchemaSequence s = ct.Particle as XmlSchemaSequence;
+                       XmlSchemaElement e2 = s.Items [0] as XmlSchemaElement;
+                       Assert.IsTrue (e2.IsNillable);
+               }
+#endif
                [Test]
                [Category ("NotWorking")]
                public void IncludeTest ()
@@ -219,5 +245,14 @@ namespace MonoTests.System.Web.Services.Description
                public class Car : Vehicle
                {
                }
+
+               public class NullableContainer
+               {
+                       [WebMethod (Description="Test nullables")]
+                       public int? GetNull ()
+                       {
+                               return null;
+                       }
+               }
        }
 }