Merge pull request #588 from Daniel15/bug-10872
[mono.git] / mcs / class / System.XML / Test / System.Xml.Schema / XmlSchemaValidatorTests.cs
index 01a084053da5eeed7a750d9288cc908543be0b81..bf258f6cc17b453e60aaafdb474fb2a07ef26fe6 100644 (file)
@@ -367,6 +367,36 @@ namespace MonoTests.System.Xml
                        if (shouldFail)
                                Assert.Fail (testName + " should fail");
                }
+
+               [Test]
+               public void Bug676993 ()
+               {
+                       Validate (File.ReadAllText ("Test/XmlFiles/676993.xml"), File.ReadAllText ("Test/XmlFiles/676993.xsd"));
+               }
+               
+               [Test]
+               public void Bug10245 ()
+               {
+                       string xsd = @"
+       <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:foo'>
+         <xs:element name='root'>
+               <xs:complexType>
+                 <xs:attribute name='d' default='v' use='optional' />
+               </xs:complexType>
+         </xs:element>
+       </xs:schema>";
+                       string xml = "<root xmlns='urn:foo' />";
+                       var xrs = new XmlReaderSettings () { ValidationType = ValidationType.Schema };
+                       xrs.Schemas.Add (XmlSchema.Read (new StringReader (xsd), null));
+                       var xr = XmlReader.Create (new StringReader (xml), xrs);
+                       xr.Read ();
+                       bool more;
+                       Assert.AreEqual (2, xr.AttributeCount, "#1");
+                       int i = 0;
+                       for (more = xr.MoveToFirstAttribute (); more; more = xr.MoveToNextAttribute ())
+                               i++;
+                       Assert.AreEqual (2, i, "#2");
+               }
        }
 }