当前位置: 首页>>代码示例>>C#>>正文


C# XamlType.GetMember方法代码示例

本文整理汇总了C#中XamlType.GetMember方法的典型用法代码示例。如果您正苦于以下问题:C# XamlType.GetMember方法的具体用法?C# XamlType.GetMember怎么用?C# XamlType.GetMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XamlType的用法示例。


在下文中一共展示了XamlType.GetMember方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseProperties

        private static IEnumerable<XamlInstruction> ParseProperties(IEnumerable<PropertyOption> options, XamlType xamlType)
        {
            foreach (var option in options)
            {
                var member = xamlType.GetMember(option.Property);
                yield return Inject.StartOfMember(member);

                var stringNode = option.Value as StringNode;
                if (stringNode != null)
                {
                    yield return Inject.Value(stringNode.Value);
                }

                yield return Inject.EndOfMember();
            }
        }
开发者ID:grokys,项目名称:OmniXAML,代码行数:16,代码来源:MarkupExtensionNodeToXamlNodesConverter.cs

示例2: ConvertAttributeToNode

        private ProtoXamlNode ConvertAttributeToNode(XamlType containingType, UnprocessedAttribute rawAttribute)
        {
            XamlMember member;

            if (rawAttribute.Locator.IsDotted)
            {
                var ownerName = rawAttribute.Locator.Owner.PropertyName;
                var ownerPrefix = rawAttribute.Locator.Owner.Prefix;

                var owner = wiringContext.TypeContext.GetByPrefix(ownerPrefix, ownerName);

                member = owner.GetAttachableMember(rawAttribute.Locator.PropertyName);
            }
            else
            {
                member = containingType.GetMember(rawAttribute.Locator.PropertyName);
            }

            return nodeBuilder.Attribute(member, rawAttribute.Value, rawAttribute.Locator.Prefix);
        }
开发者ID:gitter-badger,项目名称:OmniXAML,代码行数:20,代码来源:SuperProtoParser.cs

示例3: ConvertAttributeToNode

        // TODO: Refactor this shit.
        private ProtoXamlInstruction ConvertAttributeToNode(XamlType containingType, AttributeAssignment rawAttributeAssignment)
        {
            MutableXamlMember member;

            if (rawAttributeAssignment.Locator.IsDotted)
            {
                member = GetMemberForDottedLocator(rawAttributeAssignment.Locator);
            }
            else
            {
                if (IsNameDirective(rawAttributeAssignment.Locator, containingType))
                {
                    return instructionBuilder.Directive(CoreTypes.Name, rawAttributeAssignment.Value);
                }

                member = containingType.GetMember(rawAttributeAssignment.Locator.PropertyName);
            }

            var namespaceDeclaration = new NamespaceDeclaration(rawAttributeAssignment.Locator.Namespace, rawAttributeAssignment.Locator.Prefix);
            return instructionBuilder.Attribute(member, rawAttributeAssignment.Value, namespaceDeclaration.Prefix);
        }
开发者ID:furesoft,项目名称:OmniXAML,代码行数:22,代码来源:XamlProtoInstructionParser.cs

示例4: ConvertAttributeToNode

        private ProtoXamlInstruction ConvertAttributeToNode(XamlType containingType, AttributeAssignment rawAttributeAssignment)
        {
            MutableXamlMember member;

            if (rawAttributeAssignment.Locator.IsDotted)
            {
                var ownerName = rawAttributeAssignment.Locator.Owner.PropertyName;
                var ownerPrefix = rawAttributeAssignment.Locator.Owner.Prefix;

                var owner = wiringContext.TypeContext.GetByPrefix(ownerPrefix, ownerName);

                member = owner.GetAttachableMember(rawAttributeAssignment.Locator.PropertyName);
            }
            else
            {
                member = containingType.GetMember(rawAttributeAssignment.Locator.PropertyName);
            }

            var namespaceDeclaration = new NamespaceDeclaration(rawAttributeAssignment.Locator.Namespace, rawAttributeAssignment.Locator.Prefix);
            return instructionBuilder.Attribute(member, rawAttributeAssignment.Value, namespaceDeclaration.Prefix);
        }
开发者ID:rdterner,项目名称:OmniXAML,代码行数:21,代码来源:XamlProtoInstructionParser.cs

示例5: ParseProperties

        private IEnumerable<Instruction> ParseProperties(IEnumerable<PropertyOption> options, XamlType xamlType)
        {
            foreach (var option in options)
            {
                var member = xamlType.GetMember(option.Property);
                yield return Inject.StartOfMember(member);


                var stringNode = option.Value as StringNode;
                if (stringNode != null)
                {
                    yield return Inject.Value(stringNode.Value);
                }

                var markupExtensionNode = option.Value as MarkupExtensionNode;
                if (markupExtensionNode != null)
                {
                    foreach (var xamlInstruction in ParseMarkupExtensionNode(markupExtensionNode)) { yield return xamlInstruction; }
                }

                yield return Inject.EndOfMember();
            }
        }
开发者ID:modulexcite,项目名称:OmniXAML,代码行数:23,代码来源:MarkupExtensionNodeToXamlNodesConverter.cs

示例6: ProcessAttributesToMember

		void ProcessAttributesToMember (XamlSchemaContext sctx, StartTagInfo sti, XamlType xt)
		{
			foreach (var p in sti.Attributes) {
				int idx = p.Key.IndexOf (':');
				string prefix = idx > 0 ? p.Key.Substring (0, idx) : String.Empty;
				string aname = idx > 0 ? p.Key.Substring (idx + 1) : p.Key;
				idx = aname.IndexOf ('.');
				if (idx > 0) {
					string apns = prefix.Length > 0 ? r.LookupNamespace (prefix) : r.NamespaceURI;
					var apname = aname.Substring (0, idx);
					var axtn = new XamlTypeName (apns, apname, null);
					var at = sctx.GetXamlType (axtn);
					var am = at.GetAttachableMember (aname.Substring (idx + 1));
					if (am != null)
						sti.Members.Add (new Pair (am, p.Value));
					// ignore unknown attribute
				}
				var xm = xt.GetMember (aname);
				if (xm != null)
					sti.Members.Add (new Pair (xm, p.Value));
				// ignore unknown attribute
			}
		}
开发者ID:gitter-badger,项目名称:Portable.Xaml,代码行数:23,代码来源:XamlXmlReader.cs

示例7: ReadOnlyPropertyContainer

		public void ReadOnlyPropertyContainer ()
		{
			var xt = new XamlType (typeof (ReadOnlyPropertyContainer), sctx);
			var xm = xt.GetMember ("Bar");
			Assert.IsNotNull (xm, "#1");
			Assert.IsFalse (xm.IsWritePublic, "#2");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:7,代码来源:XamlTypeTest.cs

示例8: ContentIncluded

		public void ContentIncluded ()
		{
			var xt = new XamlType (typeof (ContentIncludedClass), sctx);
			var xm = xt.GetMember ("Content");
			Assert.AreEqual (xm, xt.ContentProperty, "#1");
			Assert.IsTrue (xt.GetAllMembers ().Contains (xm), "#2");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:7,代码来源:XamlTypeTest.cs

示例9: ListMembers

		public void ListMembers ()
		{
			var xt = new XamlType (typeof (List<int>), sctx);
			var ml = xt.GetAllMembers ().ToArray ();
			Assert.AreEqual (1, ml.Length, "#1");
			Assert.IsNotNull (xt.GetMember ("Capacity"), "#2");
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:7,代码来源:XamlTypeTest.cs

示例10: WriteNullMemberAsObject

		protected void WriteNullMemberAsObject (XamlReader r, Action validateNullInstance)
		{
			Assert.AreEqual (XamlNodeType.None, r.NodeType, "#1");
			Assert.IsTrue (r.Read (), "#6");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#7");
			Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#7-2");
			Assert.AreEqual ("clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");

			Assert.IsTrue (r.Read (), "#11");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
			Assert.AreEqual ("x", r.Namespace.Prefix, "#12-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "#12-3");

			Assert.IsTrue (r.Read (), "#16");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#17");
			var xt = new XamlType (typeof (TestClass4), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "#17-2");
//			Assert.IsTrue (r.Instance is TestClass4, "#17-3");
			Assert.AreEqual (2, xt.GetAllMembers ().Count, "#17-4");

			if (r is XamlXmlReader)
				ReadBase (r);

			Assert.IsTrue (r.Read (), "#21");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#22");
			Assert.AreEqual (xt.GetMember ("Bar"), r.Member, "#22-2");

			Assert.IsTrue (r.Read (), "#26");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#27");
			Assert.AreEqual (XamlLanguage.Null, r.Type, "#27-2");
			if (validateNullInstance != null)
				validateNullInstance ();

			Assert.IsTrue (r.Read (), "#31");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#32");

			Assert.IsTrue (r.Read (), "#36");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#37");

			Assert.IsTrue (r.Read (), "#41");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#42");
			Assert.AreEqual (xt.GetMember ("Foo"), r.Member, "#42-2");

			Assert.IsTrue (r.Read (), "#43");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#43-2");
			Assert.AreEqual (XamlLanguage.Null, r.Type, "#43-3");
			if (validateNullInstance != null)
				validateNullInstance ();

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

			Assert.IsTrue (r.Read (), "#46");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#47");

			Assert.IsTrue (r.Read (), "#51");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#52");

			Assert.IsFalse (r.Read (), "#56");
			Assert.IsTrue (r.IsEof, "#57");
		}
开发者ID:imphasing,项目名称:mono,代码行数:61,代码来源:XamlReaderTestBase.cs

示例11: Read_ArrayOrArrayExtensionOrMyArrayExtension

		protected void Read_ArrayOrArrayExtensionOrMyArrayExtension (XamlReader r, Action validateInstance, Type extType)
		{
			if (extType == typeof (MyArrayExtension)) {
				Assert.IsTrue (r.Read (), "#1");
				Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#2");
				Assert.IsNotNull (r.Namespace, "#3");
				Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#3-2");
			}
			Assert.IsTrue (r.Read (), "#11");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
			Assert.IsNotNull (r.Namespace, "#13");
			Assert.AreEqual ("x", r.Namespace.Prefix, "#13-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "#13-3");

			Assert.IsTrue (r.Read (), "#21");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#22");
			var xt = new XamlType (extType, r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "#23");
			if (validateInstance != null)
				validateInstance ();

			if (r is XamlXmlReader)
				ReadBase (r);

			// This assumption on member ordering ("Type" then "Items") is somewhat wrong, and we might have to adjust it in the future.

			Assert.IsTrue (r.Read (), "#31");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#32");
			Assert.AreEqual (xt.GetMember ("Type"), r.Member, "#33");

			Assert.IsTrue (r.Read (), "#41");
			Assert.AreEqual (XamlNodeType.Value, r.NodeType, "#42");
			Assert.AreEqual ("x:Int32", r.Value, "#43");

			Assert.IsTrue (r.Read (), "#51");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#52");

			Assert.IsTrue (r.Read (), "#61");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#62");
			Assert.AreEqual (xt.GetMember ("Items"), r.Member, "#63");

			Assert.IsTrue (r.Read (), "#71");
			Assert.AreEqual (XamlNodeType.GetObject, r.NodeType, "#71-2");
			Assert.IsNull (r.Type, "#71-3");
			Assert.IsNull (r.Member, "#71-4");
			Assert.IsNull (r.Value, "#71-5");

			Assert.IsTrue (r.Read (), "#72");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#72-2");
			Assert.AreEqual (XamlLanguage.Items, r.Member, "#72-3");

			string [] values = {"5", "-3", "0"};
			for (int i = 0; i < 3; i++) {
				Assert.IsTrue (r.Read (), i + "#73");
				Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, i + "#73-2");
				Assert.IsTrue (r.Read (), i + "#74");
				Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, i + "#74-2");
				Assert.AreEqual (XamlLanguage.Initialization, r.Member, i + "#74-3");
				Assert.IsTrue (r.Read (), i + "#75");
				Assert.IsNotNull (r.Value, i + "#75-2");
				Assert.AreEqual (values [i], r.Value, i + "#73-3");
				Assert.IsTrue (r.Read (), i + "#74");
				Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, i + "#74-2");
				Assert.IsTrue (r.Read (), i + "#75");
				Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, i + "#75-2");
			}

			Assert.IsTrue (r.Read (), "#81");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#82"); // XamlLanguage.Items

			Assert.IsTrue (r.Read (), "#83");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#84"); // GetObject

			Assert.IsTrue (r.Read (), "#85");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#86"); // ArrayExtension.Items

			Assert.IsTrue (r.Read (), "#87");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#88"); // ArrayExtension

			Assert.IsFalse (r.Read (), "#89");
		}
开发者ID:imphasing,项目名称:mono,代码行数:81,代码来源:XamlReaderTestBase.cs

示例12: Read_NonPrimitive

		protected void Read_NonPrimitive (XamlReader r)
		{
			Assert.AreEqual (XamlNodeType.None, r.NodeType, "#1");
			Assert.IsTrue (r.Read (), "#6");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#7");
			Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#7-2");
			Assert.AreEqual ("clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");

			Assert.IsTrue (r.Read (), "#11");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
			Assert.AreEqual ("x", r.Namespace.Prefix, "#12-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "#12-3");

			Assert.IsTrue (r.Read (), "#16");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#17");
			var xt = new XamlType (typeof (TestClass3), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "#17-2");
//			Assert.IsTrue (r.Instance is TestClass3, "#17-3");

			if (r is XamlXmlReader)
				ReadBase (r);

			Assert.IsTrue (r.Read (), "#21");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "#22");
			Assert.AreEqual (xt.GetMember ("Nested"), r.Member, "#22-2");

			Assert.IsTrue (r.Read (), "#26");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "#27");
			Assert.AreEqual (XamlLanguage.Null, r.Type, "#27-2");
//			Assert.IsNull (r.Instance, "#27-3");

			Assert.IsTrue (r.Read (), "#31");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#32");

			Assert.IsTrue (r.Read (), "#36");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#37");

			Assert.IsTrue (r.Read (), "#41");
			Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "#42");

			Assert.IsFalse (r.Read (), "#46");
			Assert.IsTrue (r.IsEof, "#47");
		}
开发者ID:imphasing,项目名称:mono,代码行数:43,代码来源:XamlReaderTestBase.cs

示例13: Read_CollectionContentPropertyX

		protected void Read_CollectionContentPropertyX (XamlReader r, bool contentPropertyIsUsed)
		{
			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 ("", r.Namespace.Prefix, "ns#1-4");
			var assns = "clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
			Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");

			Assert.IsTrue (r.Read (), "ns#2-1");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
			Assert.IsNotNull (r.Namespace, "ns#2-3");
			Assert.AreEqual ("sc", r.Namespace.Prefix, "ns#2-4");
			assns = "clr-namespace:System.Collections;assembly=" + typeof (IList<>).Assembly.GetName ().Name;
			Assert.AreEqual (assns, r.Namespace.Namespace, "ns#2-5");

			Assert.IsTrue (r.Read (), "ns#x-1");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#x-2");
			Assert.IsNotNull (r.Namespace, "ns#x-3");
			Assert.AreEqual ("scg", r.Namespace.Prefix, "ns#x-4");
			assns = "clr-namespace:System.Collections.Generic;assembly=" + typeof (IList<>).Assembly.GetName ().Name;
			Assert.AreEqual (assns, r.Namespace.Namespace, "ns#x-5");

			Assert.IsTrue (r.Read (), "ns#3-1");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#3-2");
			Assert.IsNotNull (r.Namespace, "ns#3-3");
			Assert.AreEqual ("x", r.Namespace.Prefix, "ns#3-4");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "ns#3-5");

			// t:CollectionContentProperty
			Assert.IsTrue (r.Read (), "so#1-1");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
			var xt = new XamlType (typeof (CollectionContentPropertyX), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "so#1-3");

			if (r is XamlXmlReader)
				ReadBase (r);

			// m:ListOfItems
			Assert.IsTrue (r.Read (), "sm1#1");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sm1#2");
			Assert.AreEqual (xt.GetMember ("ListOfItems"), r.Member, "sm1#3");

			// t:List<IEnumerable>
			xt = new XamlType (typeof (List<IEnumerable>), r.SchemaContext);
			Assert.IsTrue (r.Read (), "so#2-1");

			if (false/*contentPropertyIsUsed*/)
				Assert.AreEqual (XamlNodeType.GetObject, r.NodeType, "so#2-2.1");
			else {
				Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#2-2.2");
				Assert.AreEqual (xt, r.Type, "so#2-3");

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

				// r.Skip (); // LAMESPEC: .NET then skips to *post* Items node (i.e. at the first TestClass item)

				Assert.IsTrue (r.Read (), "v#1-1");

				// /m:Capacity
				Assert.IsTrue (r.Read (), "em#2-1");
				Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "em#2-2");
			}

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

			if (!contentPropertyIsUsed) {

				Assert.IsTrue (r.Read (), "so#x-1");
				Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#x-2.2");
				xt = new XamlType (typeof (List<object>), r.SchemaContext);
				Assert.AreEqual (xt, r.Type, "so#x-3");

				// m:Capacity
				Assert.IsTrue (r.Read (), "sm#xx-1");
				Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sm#xx-2");
				Assert.AreEqual (xt.GetMember ("Capacity"), r.Member, "sm#xx-3");

				Assert.IsTrue (r.Read (), "v#x-1");

				// /m:Capacity
				Assert.IsTrue (r.Read (), "em#xx-1");
				Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "em#xx-2");

				Assert.IsTrue (r.Read (), "sm#x-1");
				Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sm#x-2");
				Assert.AreEqual (XamlLanguage.Items, r.Member, "sm#x-3");
			}

			for (int i = 0; i < 4; i++) {
				// t:SimpleClass
				Assert.IsTrue (r.Read (), "so#3-1." + i);
				Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#3-2." + i);
				xt = new XamlType (typeof (SimpleClass), r.SchemaContext);
				Assert.AreEqual (xt, r.Type, "so#3-3." + i);
//.........这里部分代码省略.........
开发者ID:imphasing,项目名称:mono,代码行数:101,代码来源:XamlReaderTestBase.cs

示例14: Read_TypeConverterOnListMember

		protected void Read_TypeConverterOnListMember (XamlReader r)
		{
			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 ("", r.Namespace.Prefix, "ns#1-4");
			Assert.AreEqual ("http://www.domain.com/path", r.Namespace.Namespace, "ns#1-5");

			// t:TypeOtherAssembly
			Assert.IsTrue (r.Read (), "so#1-1");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
			var xt = new XamlType (typeof (SecondTest.TypeOtherAssembly), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "so#1-3");

			if (r is XamlXmlReader)
				ReadBase (r);

			// m:Values
			Assert.IsTrue (r.Read (), "sm1#1");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sm1#2");
			Assert.AreEqual (xt.GetMember ("Values"), r.Member, "sm1#3");

			// x:Value
			Assert.IsTrue (r.Read (), "v#1-1");
			Assert.AreEqual (XamlNodeType.Value, r.NodeType, "v#1-2");
			Assert.AreEqual ("1, 2, 3", r.Value, "v#1-3");

			// /m:Values
			Assert.IsTrue (r.Read (), "em#1-1");
			Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "em#1-2");

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

			Assert.IsFalse (r.Read (), "end");
		}
开发者ID:imphasing,项目名称:mono,代码行数:37,代码来源:XamlReaderTestBase.cs

示例15: Read_XmlSerializableWrapper

		protected void Read_XmlSerializableWrapper (XamlReader r, bool isObjectReader)
		{
			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 ("", r.Namespace.Prefix, "ns#1-4");
			var assns = "clr-namespace:MonoTests.System.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
			Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");

			Assert.IsTrue (r.Read (), "ns#2-1");
			Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
			Assert.IsNotNull (r.Namespace, "ns#2-3");
			Assert.AreEqual ("x", r.Namespace.Prefix, "ns#2-4");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "ns#2-5");

			// t:XmlSerializableWrapper
			Assert.IsTrue (r.Read (), "so#1-1");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
			var xt = new XamlType (typeof (XmlSerializableWrapper), r.SchemaContext);
			Assert.AreEqual (xt, r.Type, "so#1-3");

			if (r is XamlXmlReader)
				ReadBase (r);

			// m:Value
			Assert.IsTrue (r.Read (), "sm1#1");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sm1#2");
			Assert.AreEqual (xt.GetMember ("Value"), r.Member, "sm1#3");

			// x:XData
			Assert.IsTrue (r.Read (), "so#2-1");
			Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#2-2");
			Assert.AreEqual (XamlLanguage.XData, r.Type, "so#2-3");
			if (r is XamlObjectReader)
				Assert.IsNull (((XamlObjectReader) r).Instance, "xdata-instance");

			Assert.IsTrue (r.Read (), "sm2#1");
			Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sm2#2");
			Assert.AreEqual (XamlLanguage.XData.GetMember ("Text"), r.Member, "sm2#3");

			Assert.IsTrue (r.Read (), "v1#1");
			Assert.AreEqual (XamlNodeType.Value, r.NodeType, "v1#2");
			var val = isObjectReader ? "<root />" : "<root xmlns=\"" + assns + "\" />";
			Assert.AreEqual (val, r.Value, "v1#3");

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

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

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

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

			Assert.IsFalse (r.Read (), "end");
		}
开发者ID:imphasing,项目名称:mono,代码行数:60,代码来源:XamlReaderTestBase.cs


注:本文中的XamlType.GetMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。