public void Should_be_possible_to_get_value_to_objectComponentType_if_EntityItemBaseType_is_an_array()
        {
            var component = GetObjectComponentType("oval:org.mitre.oval:obj:8000", "value");

            var values = new LocalVariableObjectComponent(component, FakeSystemCharacteristics).GetValue();

            Assert.IsTrue(values.Count() > 0, UNEXPECTED_VARIABLE_VALUE_AMOUNT);
            Assert.AreEqual("4.0", values.ElementAt(0), UNEXPECTED_VARIABLE_VALUE_FOUND);            
        }
        public void Should_be_possible_ro_get_value_to_objectComponentType()
        {
            var component = GetObjectComponentType("oval:org.mitre.oval:obj:3000", "key");
            var values = new LocalVariableObjectComponent(component, FakeSystemCharacteristics).GetValue();
            Assert.IsTrue(values.Count() > 0, UNEXPECTED_VARIABLE_VALUE_AMOUNT);
            Assert.AreEqual(@"Software\Microsoft\Windows NT\CurrentVersion", values.ElementAt(0), UNEXPECTED_VARIABLE_VALUE_FOUND);

            component = GetObjectComponentType("oval:org.mitre.oval:obj:1000", "family");
            values = new LocalVariableObjectComponent(component, FakeSystemCharacteristics).GetValue();
            Assert.IsTrue(values.Count() > 0, UNEXPECTED_VARIABLE_VALUE_AMOUNT);
            Assert.AreEqual("windows", values.ElementAt(0), UNEXPECTED_VARIABLE_VALUE_FOUND);
        }
Пример #3
0
        private List<LocalVariableComponent> GetLocalVariableComponentList(oval_system_characteristics systemCharacteristics)
        {
            var components = new List<LocalVariableComponent>();
            var literalComponent = new LiteralComponentType() { Value = @"\" };
            var objectComponent1 = new ObjectComponentType() { object_ref = "oval:org.mitre.oval:obj:5000", item_field = "name" };
            var objectComponent2 = new ObjectComponentType() { object_ref = "oval:org.mitre.oval:obj:6000", item_field = "name" };
            
            var objectComponentEvaluator1 = new  LocalVariableObjectComponent(objectComponent1, systemCharacteristics);
            var literalComponentEvaluator = new LocalVariableLiteralComponent(literalComponent);
            var objectComponentEvaluator2 = new  LocalVariableObjectComponent(objectComponent2, systemCharacteristics);

            components.Add(objectComponentEvaluator1);
            components.Add(literalComponentEvaluator);
            components.Add(objectComponentEvaluator2);
            
            return components;
        }   
Пример #4
0
 public void Should_be_possible_to_add_other_components_in_the_function()
 {
     ConcatFunctionComponent functionComponent = new ConcatFunctionComponent(null,null,null);
     LocalVariableObjectComponent objectComponent = new LocalVariableObjectComponent(null, null);
     functionComponent.AddComponent(objectComponent);
     Assert.IsTrue(functionComponent.QuantityOfComponents() == 1, "the quantity of component is not expected");
 }
        public void Should_be_possible_to_get_value_to_from_an_objectComponentType_that_contains_a_record_entity_type_array()
        {
            var component = GetObjectComponentType("oval:org.mitre.oval:obj:10101", "result", "type");

            var values = new LocalVariableObjectComponent(component, FakeSystemCharacteristics).GetValue();

            Assert.AreEqual(2, values.Count(), UNEXPECTED_VARIABLE_VALUE_AMOUNT);
            Assert.AreEqual("TABLE", values.First(), UNEXPECTED_VARIABLE_VALUE_FOUND);
            Assert.AreEqual("VIEW", values.Last(), UNEXPECTED_VARIABLE_VALUE_FOUND);

            
        }