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


C# XmlSerializarionWriterTester.ExecuteWritePotentiallyReferencingElement方法代码示例

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


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

示例1: TestWritePotentiallyReferencingElement

		public void TestWritePotentiallyReferencingElement ()
		{
			XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
			xsw.Reset ();

			xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, EnumDefaultValue.e1, typeof (EnumDefaultValue), true, false);
			Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
				"<x xmlns='{0}'>1</x>", ANamespace), xsw.Content, "#1");

			xsw.Reset ();

			xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, (int) 1, typeof (EnumDefaultValue), true, false);
			Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
				"<x xmlns:q1='{0}' d1p1:type='q1:int' xmlns:d1p1='{1}' xmlns='{2}'>1</x>",
				XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),
				xsw.Content, "#2");

			xsw.Reset ();

			xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, "something", typeof (string), true, false);
			Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
				"<x xmlns='{0}'>something</x>", ANamespace), xsw.Content, "#3");

			xsw.Reset ();

			xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, "something", null, true, false);
			Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
				"<x xmlns:q2='{0}' d1p1:type='q2:string' xmlns:d1p1='{1}' xmlns='{2}'>something</x>",
				XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),
				xsw.Content, "#4");

			xsw.Reset ();

			xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, new string[] { "A", "B" }, typeof (string[]), true, false);
			Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
				"<q3:Array id='id1' xmlns:q4='{0}' q3:arrayType='q4:string[2]' xmlns:q3='{1}'>" +
				"<Item>A</Item>" +
				"<Item>B</Item>" +
				"</q3:Array>", XmlSchemaNamespace, SoapEncodingNamespace), xsw.Content, "#5");
		}
开发者ID:nobled,项目名称:mono,代码行数:40,代码来源:XmlSerializationWriterTests.cs


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