當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。