コード例 #1
0
        public void TestBuild_WithParams()
        {
            DudInterpreter interpreter = new DudInterpreter();
            IDictionary <string, IPipelineXmlInterpreter> factories = new Dictionary <string, IPipelineXmlInterpreter>();

            factories.Add("Test", interpreter);
            PipelinePersistanceProcess p = new PipelinePersistanceProcess(factories);
            AlgorithmDefinition        d = new AlgorithmDefinition("Test", new Property[] { });

            d.ParameterObject = new Cloneable();
            XElement xml = p.Build(d);

            Assert.IsTrue(xml.Descendants("properties").Any());
            Assert.IsTrue(interpreter.DidCallCreateXml);
        }
コード例 #2
0
        public void TestDecompile_WithProperty()
        {
            string name = "Test";
            IDictionary <string, IPipelineXmlInterpreter> factories = new Dictionary <string, IPipelineXmlInterpreter>();
            DudInterpreter i = new DudInterpreter();

            factories.Add("Test", i);
            PipelineXmlDecompiler decompiler = new PipelineXmlDecompiler(factories);
            XNode element = new XElement(
                "process", new XAttribute("name", name),
                new XElement("properties",
                             new XElement("property",
                                          new XAttribute("name", "test"),
                                          new XAttribute("value", "1"))));
            var d = decompiler.DecompileAlgorithm(element);

            Assert.IsNotNull(d.ParameterObject);
            Assert.IsTrue(i.DidCallCreateObject);
        }