本文整理匯總了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");
}