public void DynamicUtilityNestedTasksWithParameters_ReflectorTableInitialisedAsByServer() { var TaskSetupXml = GetNestedTasksWithParametersXML(); var processedTaskXml = "<conditional>" + " <conditions>" + " <buildCondition>" + " <value>ForceBuild</value>" + " </buildCondition>" + " <compareCondition>" + " <value1></value1>" + " <value2>Yes</value2>" + " <evaluation>Equal</evaluation>" + " </compareCondition>" + " </conditions>" + " <tasks>" + " <exec>" + " <!-- if you want the task to fail, ping an unknown server -->" + " <executable>ping.exe</executable>" + " <buildArgs>localhost</buildArgs>" + " <buildTimeoutSeconds>15</buildTimeoutSeconds>" + " <description>Pinging a server</description>" + " </exec>" + " <conditional>" + " <conditions>" + " <compareCondition>" + " <value1></value1>" + " <value2>Yes</value2>" + " <evaluation>Equal</evaluation>" + " </compareCondition>" + " </conditions>" + " <tasks>" + " <exec>" + " <!-- if you want the task to fail, ping an unknown server -->" + " <executable>ping.exe</executable>" + " <buildArgs></buildArgs>" + " <buildTimeoutSeconds>15</buildTimeoutSeconds>" + " <description>Pinging a server</description>" + " <dynamicValues>" + " <directValue>" + " <parameter>TagVersion</parameter>" + " <property>buildArgs</property>" + " </directValue>" + " </dynamicValues>" + " </exec>" + " </tasks>" + " <dynamicValues>" + " <directValue>" + " <parameter>TagBuild</parameter>" + " <property>conditions[0].value1</property>" + " </directValue>" + " </dynamicValues>" + " </conditional>" + " </tasks>" + " <dynamicValues>" + " <directValue>" + " <parameter>CommitBuild</parameter>" + " <property>conditions[1].value1</property>" + " </directValue>" + " </dynamicValues>" + "</conditional>"; var xdoc = new System.Xml.XmlDocument(); xdoc.LoadXml(TaskSetupXml); Objection.ObjectionStore objectionStore = new Objection.ObjectionStore(); Exortech.NetReflector.NetReflectorTypeTable typeTable = Exortech.NetReflector.NetReflectorTypeTable.CreateDefault(new Objection.NetReflectorPlugin.ObjectionNetReflectorInstantiator(objectionStore)); var result = ThoughtWorks.CruiseControl.Core.Tasks.DynamicValueUtility.ConvertXmlToDynamicValues(typeTable, xdoc.DocumentElement, null); Console.WriteLine(result.OuterXml); xdoc.LoadXml(processedTaskXml); // load in xdoc to ease comparing xml documents Assert.AreEqual(xdoc.OuterXml, result.OuterXml); }
public void DynamicUtilityNestedTasksWithParameters_ReflectorTableInitialisedAsByServer() { var TaskSetupXml = GetNestedTasksWithParametersXML(); var processedTaskXml = "<conditional>" + " <conditions>" + " <buildCondition>" + " <value>ForceBuild</value>" + " </buildCondition>" + " <compareCondition>" + " <value1></value1>" + " <value2>Yes</value2>" + " <evaluation>Equal</evaluation>" + " </compareCondition>" + " </conditions>" + " <tasks>" + " <exec>" + " <!-- if you want the task to fail, ping an unknown server -->" + " <executable>ping.exe</executable>" + " <buildArgs>localhost</buildArgs>" + " <buildTimeoutSeconds>15</buildTimeoutSeconds>" + " <description>Pinging a server</description>" + " </exec>" + " <conditional>" + " <conditions>" + " <compareCondition>" + " <value1></value1>" + " <value2>Yes</value2>" + " <evaluation>Equal</evaluation>" + " </compareCondition>" + " </conditions>" + " <tasks>" + " <exec>" + " <!-- if you want the task to fail, ping an unknown server -->" + " <executable>ping.exe</executable>" + " <buildArgs></buildArgs>" + " <buildTimeoutSeconds>15</buildTimeoutSeconds>" + " <description>Pinging a server</description>" + " <dynamicValues>" + " <directValue>" + " <parameter>TagVersion</parameter>" + " <property>buildArgs</property>" + " </directValue>" + " </dynamicValues>" + " </exec>" + " </tasks>" + " <dynamicValues>" + " <directValue>" + " <parameter>TagBuild</parameter>" + " <property>conditions[0].value1</property>" + " </directValue>" + " </dynamicValues>" + " </conditional>" + " </tasks>" + " <dynamicValues>" + " <directValue>" + " <parameter>CommitBuild</parameter>" + " <property>conditions[1].value1</property>" + " </directValue>" + " </dynamicValues>" + "</conditional>"; var xdoc = new System.Xml.XmlDocument(); xdoc.LoadXml(TaskSetupXml); Objection.ObjectionStore objectionStore = new Objection.ObjectionStore(); Exortech.NetReflector.NetReflectorTypeTable typeTable = Exortech.NetReflector.NetReflectorTypeTable.CreateDefault(new Objection.NetReflectorPlugin.ObjectionNetReflectorInstantiator(objectionStore)); var result = ThoughtWorks.CruiseControl.Core.Tasks.DynamicValueUtility.ConvertXmlToDynamicValues(typeTable, xdoc.DocumentElement, null); Console.WriteLine(result.OuterXml); xdoc.LoadXml(processedTaskXml); // load in xdoc to ease comparing xml documents Assert.AreEqual(xdoc.OuterXml, result.OuterXml); }