Ejemplo n.º 1
0
        public void TestDecompileAlgorithm_NotElement()
        {
            XText t = new XText("Test");
            DefinitionXmlDecompiler d = new DefinitionXmlDecompiler();

            d.DecompileAlgorithm(t);
        }
Ejemplo n.º 2
0
        public void TestDecompileAlgorithm_NoProperties()
        {
            DefinitionXmlDecompiler decompiler = new DefinitionXmlDecompiler();
            XElement xml = new XElement("algorithm",
                                        new XAttribute("name", "gamma"));
            AlgorithmDefinition a = decompiler.DecompileAlgorithm(xml);

            Assert.AreEqual("gamma", a.AlgorithmName);
            Assert.AreEqual(0, a.Properties.Count);
        }
Ejemplo n.º 3
0
        public void TestDecompileAlgorithm_OneProperty_Primitive()
        {
            DefinitionXmlDecompiler decompiler = new DefinitionXmlDecompiler();
            XElement xml = new XElement("algorithm",
                                        new XAttribute("name", "gamma"),
                                        new XElement("properties",
                                                     new XElement("property",
                                                                  new XAttribute("name", "gamma"),
                                                                  new XAttribute("type", typeof(double)),
                                                                  new XAttribute("value", "1"))));
            AlgorithmDefinition a = decompiler.DecompileAlgorithm(xml);

            Assert.AreEqual(1, a.Properties.Count);

            Property gamma = a.Properties.First();

            Assert.AreEqual("gamma", gamma.Name);
            Assert.AreEqual(typeof(double), gamma.Type);
            Assert.IsNull(gamma.Converter);
            Assert.IsNull(gamma.Compressor);
            Assert.AreEqual(1d, gamma.Value);
        }