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