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); }
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() { var component = GetObjectComponentType("oval:org.mitre.oval:obj:10100", "result", "uid"); var values = new LocalVariableObjectComponent(component, FakeSystemCharacteristics).GetValue(); Assert.AreEqual(1, values.Count(), UNEXPECTED_VARIABLE_VALUE_AMOUNT); Assert.AreEqual("2048", values.First(), UNEXPECTED_VARIABLE_VALUE_FOUND); }
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); }