Example #1
0
        public void TestValidateAlgorithm_NoName_NoThrow()
        {
            TestVisitor     v       = new TestVisitor();
            JobXmlValidator visitor = new JobXmlValidator(v);

            XNode xml = new XElement("algorithm");

            visitor.VisitAlgorithm(xml);
            Assert.IsFalse(v.VisitedAlgorithm);
        }
Example #2
0
        public void TestValidateAlgorithm_PropertyNoType_NoThrow()
        {
            TestVisitor     v       = new TestVisitor();
            JobXmlValidator visitor = new JobXmlValidator(v);

            XNode xml = new XElement("algorithm", new XAttribute("name", "gamma"),
                                     new XElement("properties",
                                                  new XElement("property",
                                                               new XAttribute("name", "gamma"),
                                                               new XAttribute("value", "1"))));

            visitor.VisitAlgorithm(xml);
            Assert.IsFalse(v.VisitedAlgorithm);
        }
Example #3
0
        public void TestValidateAlgorithm_InvalidXml()
        {
            TestVisitor     v       = new TestVisitor();
            JobXmlValidator visitor = new JobXmlValidator(v);

            visitor.ThrowOnError = true;

            XNode xml = new XElement("algorithm", new XAttribute("name", "gamma"),
                                     new XElement("properties",
                                                  new XElement("property",
                                                               new XAttribute("name", "gamma"),
                                                               new XAttribute("type", "notatype"))));

            visitor.VisitAlgorithm(xml);
        }
Example #4
0
        public void TestValidateAlgorithm_ValidXml()
        {
            TestVisitor     v       = new TestVisitor();
            JobXmlValidator visitor = new JobXmlValidator(v);

            XNode 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"))));

            visitor.VisitAlgorithm(xml);
            Assert.IsTrue(v.VisitedAlgorithm);
        }
Example #5
0
 public void TestConstructor_ValidArgs()
 {
     TestVisitor     v       = new TestVisitor();
     JobXmlValidator visitor = new JobXmlValidator(v);
 }
Example #6
0
 public void TestConstructor_NullArgs()
 {
     JobXmlValidator v = new JobXmlValidator(null);
 }