Пример #1
0
        public void TestDecompileAlgorithm_NotElement()
        {
            XText            t = new XText("Test");
            JobXmlDecompiler d = new JobXmlDecompiler();

            d.DecompileAlgorithm(t);
        }
Пример #2
0
        public void TestDecompileAlgorithm_NoProperties()
        {
            JobXmlDecompiler decompiler = new JobXmlDecompiler();
            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);
        }
Пример #3
0
        public void TestDecompileAlgorithm_OneProperty_Primitive()
        {
            JobXmlDecompiler decompiler = new JobXmlDecompiler();
            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);
        }