Exemplo n.º 1
0
        public void PositionalParameters2()
        {
            var obj = new PositionalParametersWrapper("foo", 5);
            var r   = new XamlObjectReader(obj);

            PositionalParameters2(r);
        }
Exemplo n.º 2
0
        public void Write_PositionalParameters1Wrapper()
        {
            // Unlike the above case, this has the wrapper object and hence PositionalParametersClass1 can be written as an attribute (markup extension)
            var obj = new PositionalParametersWrapper("foo", 5);

            Assert.AreEqual(ReadXml("PositionalParametersWrapper.xml").Trim(), XamlServices.Save(obj), "#1");
        }
Exemplo n.º 3
0
		public void PositionalParameters2 ()
		{
			var obj = new PositionalParametersWrapper ("foo", 5);
			var r = new XamlObjectReader (obj);
			PositionalParameters2 (r);
		}
Exemplo n.º 4
0
		public void PositionalParameters2 ()
		{
			// ns1 > T:PositionalParametersWrapper > M:Body > T:PositionalParametersClass1 > M:_PositionalParameters > foo > 5 > EM:_PositionalParameters > ET:PositionalParametersClass1

			var obj = new PositionalParametersWrapper ("foo", 5);
			var r = new XamlObjectReader (obj);

			Assert.IsTrue (r.Read (), "ns#1-1");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
			Assert.IsNotNull (r.Namespace, "ns#1-3");
			Assert.AreEqual (String.Empty, r.Namespace.Prefix, "ns#1-4");
			Assert.AreEqual ("clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");

			Assert.IsTrue (r.Read (), "so#1-1");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
			var xt = new XamlType (typeof (PositionalParametersWrapper), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "so#1-3");
			Assert.AreEqual (obj, r.Instance, "so#1-4");

			Assert.IsTrue (r.Read (), "sm#1-1");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sm#1-2");
			Assert.AreEqual (xt.GetMember ("Body"), r.Member, "sm#1-3");

			xt = new XamlType (typeof (PositionalParametersClass1), r.SchemaContext);
			Assert.IsTrue (r.Read (), "so#2-1");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#2-2");
			Assert.AreEqual (xt, r.Type, "so#2-3");
			Assert.AreEqual (obj.Body, r.Instance, "so#2-4");

			Assert.IsTrue (r.Read (), "sposprm#1");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sposprm#2");
			Assert.AreEqual (XamlLanguage.PositionalParameters, r.Member, "sposprm#3");

			Assert.IsTrue (r.Read (), "sva#1-1");
			Assert.AreEqual (XamlNodeType.Value, r.NodeType, "sva#1-2");
			Assert.AreEqual ("foo", r.Value, "sva#1-3");

			Assert.IsTrue (r.Read (), "sva#2-1");
			Assert.AreEqual (XamlNodeType.Value, r.NodeType, "sva#2-2");
			Assert.AreEqual ("5", r.Value, "sva#2-3");

			Assert.IsTrue (r.Read (), "eposprm#1");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "eposprm#2"); // XamlLanguage.PositionalParameters

			Assert.IsTrue (r.Read (), "eo#2-1");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "eo#2-2");

			Assert.IsTrue (r.Read (), "em#1-1");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "eo#1-2");

			Assert.IsTrue (r.Read (), "eo#1-1");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "eo#1-2");

			Assert.IsFalse (r.Read (), "end");
		}