Beispiel #1
0
        public void Should_be_possible_to_get_a_value_of_filter_element_in_a_set()
        {
            set    setElement  = SetFactory.GetSetFromDefinitionsOfRegistryObject("definitionsWithSet.xml", "oval:org.mitre.oval:obj:10000");
            string filterValue = setElement.GetFilterValue();

            Assert.AreEqual("oval:org.mitre.oval:ste:99", filterValue);
        }
Beispiel #2
0
        public void Should_be_possible_to_get_child_set_references()
        {
            set setElement = SetFactory.GetSetFromDefinitionsOfRegistryObject("definitionsWithSet.xml", "oval:org.mitre.oval:obj:5000");
            IEnumerable <set> objectReferences = setElement.GetSets();

            Assert.AreEqual(2, objectReferences.Count(), "the number of sets is not expected");
        }
Beispiel #3
0
        public void Should_be_possible_to_get_an_item_value()
        {
            set    setElement = SetFactory.GetSetFromDefinitionsOfRegistryObject("definitionsWithSet.xml", "oval:org.mitre.oval:obj:5000");
            object itemValue  = setElement.GetItemValue(set_items.set);

            Assert.IsNotNull(itemValue, "item value not found in set element");
        }
Beispiel #4
0
        public void Should_be_possible_to_evaluate_a_Set_in_the_ObjectType()
        {
            OvalDocumentLoader ovalDocument = new OvalDocumentLoader();

            sc.oval_system_characteristics systemCharacteristics = ovalDocument.GetFakeOvalSystemCharacteristics("system_characteristics_with_sets.xml");
            oval_definitions        definitions = ovalDocument.GetFakeOvalDefinitions("definitionsWithSet.xml");
            IEnumerable <StateType> states      = definitions.states;

            set registryObjectSet = SetFactory.GetSetFromDefinitionsOfRegistryObject("definitionsWithSet.xml", "oval:org.mitre.oval:obj:6000");

            SetEvaluator setEvaluator = new SetEvaluator(systemCharacteristics, states, null);
            SetResult    result       = setEvaluator.Evaluate(registryObjectSet);

            Assert.IsNotNull(result, "the items expected is null");
            Assert.AreEqual(3, result.Result.Count(), "the quantity of items is not expected");
            Assert.AreEqual(FlagEnumeration.complete, result.ObjectFlag, "the object flag is not expected");

            string element = result.Result.Where <string>(item => item == "1").SingleOrDefault();

            Assert.IsNotNull(element, "the element expected is not exits");
            element = result.Result.Where <string>(item => item == "2").SingleOrDefault();
            Assert.IsNotNull(element, "the element expected is not exits");
            element = result.Result.Where <string>(item => item == "3").SingleOrDefault();
            Assert.IsNotNull(element, "the element expected is not exits");
        }
Beispiel #5
0
        public void Should_be_possible_to_verify_if_a_set_has_another_set()
        {
            set setElement = SetFactory.GetSetFromDefinitionsOfRegistryObject("definitionsWithSet.xml", "oval:org.mitre.oval:obj:5000");

            Assert.AreEqual(true, setElement.ExistsAnotherSetElement(), "the set element not has another set");

            setElement = SetFactory.GetSetFromDefinitionsOfRegistryObject("definitionsWithSet.xml", "oval:org.mitre.oval:obj:6000");
            Assert.AreEqual(false, setElement.ExistsAnotherSetElement(), "the set element has another set");
        }
Beispiel #6
0
        public void Should_be_possible_to_get_an_object_references_from_a_set()
        {
            set setElement = SetFactory.GetSetFromDefinitionsOfRegistryObject("definitionsWithSet.xml", "oval:org.mitre.oval:obj:7000");
            IEnumerable <string> objectReferences = setElement.GetObjectReferences();

            Assert.AreEqual(2, objectReferences.Count(), "the number of objectReferences is not expected");

            Object firstObject  = objectReferences.Where(obj => obj == "oval:org.mitre.oval:obj:4000").SingleOrDefault();
            Object secondObject = objectReferences.Where(obj => obj == "oval:org.mitre.oval:obj:2000").SingleOrDefault();

            Assert.IsNotNull(firstObject, "the object expected is not found");
            Assert.IsNotNull(secondObject, "the object expected is not found");
        }
Beispiel #7
0
        public void Should_be_possible_to_verify_if_a_set_has_filter_element()
        {
            set setElement = SetFactory.GetSetFromDefinitionsOfRegistryObject("definitionsWithSet.xml", "oval:org.mitre.oval:obj:10000");

            Assert.IsTrue(setElement.HasFilterElement(), "the set element is not has a filter element");
        }