Beispiel #1
0
        public void TestValidateAlgorithm_NameAttributeNoValue()
        {
            XElement               element   = new XElement("algorithm", new XAttribute("name", string.Empty));
            DudVisitor             visitor   = new DudVisitor();
            DefinitionXmlValidator validator = new DefinitionXmlValidator(visitor);

            validator.VisitAlgorithm(element);

            Assert.IsFalse(visitor.DidVisitAlgorithm);
        }
Beispiel #2
0
        public void TestValidateAlgorithm_NoProperties()
        {
            XElement               element   = new XElement("algorithm", new XAttribute("name", "test"));
            DudVisitor             visitor   = new DudVisitor();
            DefinitionXmlValidator validator = new DefinitionXmlValidator(visitor);

            validator.VisitAlgorithm(element);

            Assert.IsTrue(visitor.DidVisitAlgorithm);
        }
Beispiel #3
0
        public void TestValidateAlgorithm_NoAlgorithmNameAttribute()
        {
            XElement               element   = new XElement("algorithm");
            DudVisitor             visitor   = new DudVisitor();
            DefinitionXmlValidator validator = new DefinitionXmlValidator(visitor);

            validator.VisitAlgorithm(element);

            Assert.IsFalse(visitor.DidVisitAlgorithm);
        }
Beispiel #4
0
        public void TestValidateAlgorithm_InvalidElementName()
        {
            XElement               element   = new XElement("BadElement");
            DudVisitor             visitor   = new DudVisitor();
            DefinitionXmlValidator validator = new DefinitionXmlValidator(visitor);

            validator.VisitAlgorithm(element);

            Assert.IsFalse(visitor.DidVisitAlgorithm);
        }
Beispiel #5
0
        public void TestValidateAlgorithm_NotAnElement()
        {
            XText                  text      = new XText("test");
            DudVisitor             visitor   = new DudVisitor();
            DefinitionXmlValidator validator = new DefinitionXmlValidator(visitor);

            validator.VisitAlgorithm(text);

            Assert.IsFalse(visitor.DidVisitAlgorithm);
        }
Beispiel #6
0
        public void TestValidateAlgorithm_OneProperty_NoNameValue()
        {
            XElement element = new XElement(
                "algorithm", new XAttribute("name", "test"),
                new XElement("properties",
                             new XElement("property", new XAttribute("name", string.Empty))));
            DudVisitor             visitor   = new DudVisitor();
            DefinitionXmlValidator validator = new DefinitionXmlValidator(visitor);

            validator.VisitAlgorithm(element);

            Assert.IsFalse(visitor.DidVisitAlgorithm);
        }
Beispiel #7
0
        public void TestValidateAlgorithm_OneProperty_ValueAttr()
        {
            XElement element = new XElement(
                "algorithm", new XAttribute("name", "test"),
                new XElement("properties",
                             new XElement("property",
                                          new XAttribute("name", "test"),
                                          new XAttribute("type", typeof(double)),
                                          new XAttribute("value", "1"))));
            DudVisitor             visitor   = new DudVisitor();
            DefinitionXmlValidator validator = new DefinitionXmlValidator(visitor);

            validator.VisitAlgorithm(element);

            Assert.IsTrue(visitor.DidVisitAlgorithm);
        }