本文整理汇总了C#中TestTask.PreprocessParameters方法的典型用法代码示例。如果您正苦于以下问题:C# TestTask.PreprocessParameters方法的具体用法?C# TestTask.PreprocessParameters怎么用?C# TestTask.PreprocessParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestTask
的用法示例。
在下文中一共展示了TestTask.PreprocessParameters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PreprocessParametersAddsDirectValueForValidAttributeDynamicValue
public void PreprocessParametersAddsDirectValueForValidAttributeDynamicValue()
{
var document = new XmlDocument();
var xml = "<item attrib=\"$[value|default]\"><subItem>Text</subItem></item>";
document.LoadXml(xml);
var task = new TestTask();
var actual = task.PreprocessParameters(new NetReflectorTypeTable(), document.DocumentElement);
var expected = "<item attrib=\"default\"><subItem>Text</subItem>" +
"<dynamicValues>" +
"<directValue>" +
"<parameter>value</parameter>" +
"<default>default</default>" +
"<property>attrib</property>" +
"</directValue>" +
"</dynamicValues></item>";
Assert.AreEqual(expected, actual.OuterXml);
}
示例2: PreprocessParametersAddsMultipleReplacementValueForValidNodeDynamicValueWithFormat
public void PreprocessParametersAddsMultipleReplacementValueForValidNodeDynamicValueWithFormat()
{
var document = new XmlDocument();
var xml = "<item attrib=\"value\"><subItem>$[value1|default|00] $[value2|default|00]</subItem></item>";
document.LoadXml(xml);
var task = new TestTask();
var actual = task.PreprocessParameters(new NetReflectorTypeTable(), document.DocumentElement);
var expected = "<item attrib=\"value\"><subItem></subItem>" +
"<dynamicValues>" +
"<replacementValue>" +
"<format>{0:00} {1:00}</format>" +
"<parameters>" +
"<namedValue name=\"value1\" value=\"default\" />" +
"<namedValue name=\"value2\" value=\"default\" />" +
"</parameters>" +
"<property>subItem</property>" +
"</replacementValue>" +
"</dynamicValues></item>";
Assert.AreEqual(expected, actual.OuterXml);
}
示例3: PreprocessParametersAddsSingleReplacementValueForValidAttributeDynamicValueWithoutDefault
public void PreprocessParametersAddsSingleReplacementValueForValidAttributeDynamicValueWithoutDefault()
{
var document = new XmlDocument();
var xml = "<item attrib=\"($[value1])\"><subItem>Text</subItem></item>";
document.LoadXml(xml);
var task = new TestTask();
var actual = task.PreprocessParameters(new NetReflectorTypeTable(), document.DocumentElement);
var expected = "<item attrib=\"\"><subItem>Text</subItem>" +
"<dynamicValues>" +
"<replacementValue>" +
"<format>({0})</format>" +
"<parameters>" +
"<namedValue name=\"value1\" />" +
"</parameters>" +
"<property>attrib</property>" +
"</replacementValue>" +
"</dynamicValues></item>";
Assert.AreEqual(expected, actual.OuterXml);
}
示例4: XmlDocument
public void PreprocessParametersAddsDirectValueForValidDoublyNestedNodesDynamicValueWithoutDefaultWithTextFirstAndMiddleChild()
{
var document = new XmlDocument();
var xml = "<item attrib=\"value\"><subItems><subItem><subSubItems>some text<subSubItem><value>$[value]</value></subSubItem>some text<subSubItem><value>$[value2]</value></subSubItem></subSubItems></subItem></subItems></item>";
document.LoadXml(xml);
var task = new TestTask();
NetReflectorTypeTable typeTable = new NetReflectorTypeTable();
typeTable.Add(typeof(Item));
typeTable.Add(typeof(SubItem));
typeTable.Add(typeof(subSubItem));
var actual = task.PreprocessParameters(typeTable, document.DocumentElement);
var expected = "<item attrib=\"value\"><subItems><subItem><subSubItems>some text<subSubItem><value></value></subSubItem>some text<subSubItem><value></value></subSubItem></subSubItems></subItem></subItems>" +
"<dynamicValues>" +
"<directValue>" +
"<parameter>value</parameter>" +
"<property>subItems[0].subSubItems[0].value</property>" +
"</directValue>" +
"<directValue>" +
"<parameter>value2</parameter>" +
"<property>subItems[0].subSubItems[1].value</property>" +
"</directValue>" +
"</dynamicValues></item>";
Assert.AreEqual(expected, actual.OuterXml);
}
示例5: PreprocessParametersAddsDirectValueForValidNestedNodesDynamicValueWithoutDefaultWithComment
public void PreprocessParametersAddsDirectValueForValidNestedNodesDynamicValueWithoutDefaultWithComment()
{
var document = new XmlDocument();
var xml = "<item attrib=\"value\"><subItems><subItem>$[value]</subItem><!-- this is a comment --><subItem>$[value2]</subItem></subItems></item>";
document.LoadXml(xml);
var task = new TestTask();
NetReflectorTypeTable typeTable = new NetReflectorTypeTable();
typeTable.Add(typeof(Item));
var actual = task.PreprocessParameters(typeTable, document.DocumentElement);
var expected = "<item attrib=\"value\"><subItems><subItem></subItem><!-- this is a comment --><subItem></subItem></subItems>" +
"<dynamicValues>" +
"<directValue>" +
"<parameter>value</parameter>" +
"<property>subItems[0]</property>" +
"</directValue>" +
"<directValue>" +
"<parameter>value2</parameter>" +
"<property>subItems[1]</property>" +
"</directValue>" +
"</dynamicValues></item>";
Assert.AreEqual(expected, actual.OuterXml);
}
示例6: PreprocessParametersReturnsOriginalNodeWhenNoDynamicValues
public void PreprocessParametersReturnsOriginalNodeWhenNoDynamicValues()
{
var document = new XmlDocument();
var xml = "<item attrib=\"value\"><subItem>Text</subItem></item>";
document.LoadXml(xml);
var task = new TestTask();
var actual = task.PreprocessParameters(new NetReflectorTypeTable(), document.DocumentElement);
Assert.AreEqual(xml, actual.OuterXml);
}
示例7: PreprocessParametersAddsDirectValueForValidDoublyNestedMixedDynamicValuesNodes
public void PreprocessParametersAddsDirectValueForValidDoublyNestedMixedDynamicValuesNodes()
{
var document = new XmlDocument();
var xml = "<item attrib=\"value\"><subItems><subItem><subSubItemsDV><subSubItemDV><prop>$[value]</prop></subSubItemDV></subSubItemsDV><prop>$[value2]</prop></subItem></subItems></item>";
document.LoadXml(xml);
var task = new TestTask();
NetReflectorTypeTable typeTable = new NetReflectorTypeTable();
typeTable.Add(typeof(Item));
typeTable.Add(typeof(SubItem));
typeTable.Add(typeof(SubItemDV));
typeTable.Add(typeof(subSubItemDV));
var actual = task.PreprocessParameters(typeTable, document.DocumentElement);
var expected = "<item attrib=\"value\"><subItems><subItem><subSubItemsDV>" +
"<subSubItemDV>" +
"<prop></prop>" +
"<dynamicValues>" +
"<directValue>" +
"<parameter>value</parameter>" +
"<property>prop</property>" +
"</directValue>" +
"</dynamicValues>" +
"</subSubItemDV>" +
"</subSubItemsDV>" +
"<prop></prop>" +
"</subItem></subItems>" +
"<dynamicValues>" +
"<directValue>" +
"<parameter>value2</parameter>" +
"<property>subItems[0].prop</property>" +
"</directValue>" +
"</dynamicValues>" +
"</item>";
Assert.AreEqual(expected, actual.OuterXml);
}