コード例 #1
0
        public void PositionalParameters1()
        {
            // Note: this can be read, but cannot be written to XML.
            var obj = new PositionalParametersClass1("foo", 5);
            var r   = new XamlObjectReader(obj);

            PositionalParameters1(r);
        }
コード例 #2
0
        public void Write_PositionalParameters1()
        {
            // PositionalParameters can only be written when the
            // instance is NOT the root object.
            //
            // A single positional parameter can be written as an
            // attribute, but there are two in PositionalParameters1.
            //
            // A default constructor could be used to not use
            // PositionalParameters, but there isn't in this type.
            var obj = new PositionalParametersClass1("foo", 5);

            XamlServices.Save(obj);
        }
コード例 #3
0
		public void PositionalParameters1 ()
		{
			// Note: this can be read, but cannot be written to XML.
			var obj = new PositionalParametersClass1 ("foo", 5);
			var r = new XamlObjectReader (obj);
			PositionalParameters1 (r);
		}
コード例 #4
0
ファイル: TestedTypes.cs プロジェクト: litoMalone/mono
		public PositionalParametersWrapper (string foo, int bar)
		{
			Body = new PositionalParametersClass1 (foo, bar);
		}
コード例 #5
0
ファイル: TestedTypes.cs プロジェクト: yonder/mono
 public PositionalParametersWrapper(string foo, int bar)
 {
     Body = new PositionalParametersClass1(foo, bar);
 }
コード例 #6
0
		public void PositionalParameters1 ()
		{
			// ns1 > T:PositionalParametersClass1 > M:_PositionalParameters > foo > 5 > EM:_PositionalParameters > ET:PositionalParametersClass1

			// Note: this can be read, but cannot be written to XML.
			var obj = new PositionalParametersClass1 ("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 (PositionalParametersClass1), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "so#1-3");
			Assert.AreEqual (obj, r.Instance, "so#1-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#1-1");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "eo#1-2");

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