Merge pull request #819 from brendanzagaeski/patch-1
[mono.git] / mcs / class / System.XML / Test / System.Xml / XmlReaderCommonTests.cs
index 749e601abdaa53a98fce481c4c7cd278bb66a154..a969b3b3f7304bbef07a38740ff452a0f7a30c85 100644 (file)
@@ -2270,6 +2270,23 @@ namespace MonoTests.System.Xml
                        Assert.AreEqual (arr [1], ret [1], "#3");\r
                }\r
 \r
+               [Test]\r
+               public void ReadContentAs ()\r
+               {\r
+                       var xr = XmlReader.Create (new StringReader ("<doc a=' 1 '/>"));\r
+                       xr.Read ();\r
+                       xr.MoveToAttribute ("a");\r
+\r
+                       Assert.AreEqual ((Byte) 1, xr.ReadContentAs (typeof (Byte), null), "#1");\r
+                       Assert.AreEqual ((SByte) 1, xr.ReadContentAs (typeof (SByte), null), "#2");\r
+                       Assert.AreEqual ((Int16) 1, xr.ReadContentAs (typeof (Int16), null), "#3");\r
+                       Assert.AreEqual ((UInt16) 1, xr.ReadContentAs (typeof (UInt16), null), "#4");\r
+                       Assert.AreEqual ((Int32) 1, xr.ReadContentAs (typeof (Int32), null), "#5");\r
+                       Assert.AreEqual ((UInt32) 1, xr.ReadContentAs (typeof (UInt32), null), "#6");\r
+                       Assert.AreEqual ((Int64) 1, xr.ReadContentAs (typeof (Int64), null), "#7");\r
+                       Assert.AreEqual ((UInt64) 1, xr.ReadContentAs (typeof (UInt64), null), "#8");\r
+               }\r
+\r
 #if NET_4_5\r
                [Test]\r
                [ExpectedException(typeof(InvalidOperationException))]\r