Ejemplo n.º 1
0
		public void Skip3 ()
		{
			var r = new XamlObjectReader (new ReadOnlyPropertyContainer () { Foo = "x" });
			while (r.NodeType != XamlNodeType.StartMember)
				r.Read ();
			r.Skip ();
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#1");
		}
Ejemplo n.º 2
0
		public void Skip2 ()
		{
			var r = new XamlObjectReader ("Foo");
			r.Read (); // NamespaceDeclaration
			r.Read (); // Type
			r.Read (); // Member (Initialization)
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#1");
			r.Skip ();
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#2");
			r.Skip ();
			Assert.IsTrue (r.IsEof, "#3");
		}
Ejemplo n.º 3
0
		public void Read2 ()
		{
			var doc = new XmlDocument ();
			doc.LoadXml ("<root xmlns='urn:foo'><elem attr='val' /></root>");
			var r = new XamlObjectReader (doc);

			for (int i = 0; i < 3; i++) {
				r.Read ();
				Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#1-" + i);
			}
			r.Read ();

			Assert.AreEqual (new XamlType (typeof (XmlDocument), r.SchemaContext), r.Type, "#2");
			r.Read ();
			var l = new List<XamlMember> ();
			for (int i = 0; i < 5; i++) {
				Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#3-" + i);
				l.Add (r.Member);
				r.Skip ();
			}
			l.First (m => m.Name == "Value");
			l.First (m => m.Name == "InnerXml");
			l.First (m => m.Name == "Prefix");
			l.First (m => m.Name == "PreserveWhitespace");
			l.First (m => m.Name == "Schemas");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#4");
			Assert.IsFalse (r.Read (), "#5");
		}
Ejemplo n.º 4
0
		public void Skip ()
		{
			var r = new XamlObjectReader ("Foo");
			r.Skip ();
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#1");
			r.Skip ();
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#2");
			r.Skip ();
			Assert.IsTrue (r.IsEof, "#3");
		}