public void Should_not_be_possible_to_get_value_to_variableComponent_if_this_variable_refer_his_localVariable() { OvalDocumentLoader ovalDocuments = new OvalDocumentLoader(); oval_definitions definitions = ovalDocuments.GetFakeOvalDefinitions("definitionsWithLocalVariable.xml"); Assert.IsNotNull(definitions); oval_system_characteristics systemSystemCharacteristics = ovalDocuments.GetFakeOvalSystemCharacteristics("system_characteristics_with_local_variable.xml"); Assert.IsNotNull(systemSystemCharacteristics); VariablesTypeVariableLocal_variable localVariable = new VariablesTypeVariableLocal_variable() { id = "oval:org.mitre.oval:var:4000" }; VariableComponentType variableComponent = new VariableComponentType() { var_ref = "oval:org.mitre.oval:var:4000" }; LocalVariableVariablesComponent variableComponentEvaluator = new LocalVariableVariablesComponent(localVariable,variableComponent, definitions.variables, systemSystemCharacteristics); IEnumerable<string> values = variableComponentEvaluator.GetValue(); Assert.IsTrue(values.Count() == 0); }
public void Should_be_possible_to_get_value_to_variableComponent_by_the_constantVariable() { oval_definitions definitions = new OvalDocumentLoader().GetFakeOvalDefinitions("definitionsWithLocalVariable.xml"); Assert.IsNotNull(definitions); VariableComponentType variableComponent = new VariableComponentType() { var_ref = "oval:org.mitre.oval:var:3000" }; VariablesTypeVariableLocal_variable localVariable = new VariablesTypeVariableLocal_variable() { id = "oval:org.mitre.oval:var:5000" }; LocalVariableVariablesComponent variableComponentEvaluator = new LocalVariableVariablesComponent(localVariable,variableComponent,definitions.variables,null); IEnumerable<string> values = variableComponentEvaluator.GetValue(); Assert.IsTrue(values.Count() > 0, "the quantity of values is not expected."); Assert.IsTrue(values.ElementAt(0) == "Multiprocessor Free", "the value is not expected"); }
public void Should_be_possible_to_get_value_to_variableComponent_by_the_LocalVariable() { OvalDocumentLoader ovalDocuments = new OvalDocumentLoader(); oval_definitions definitions = ovalDocuments.GetFakeOvalDefinitions("definitionsWithLocalVariable.xml"); Assert.IsNotNull(definitions); oval_system_characteristics systemSystemCharacteristics = ovalDocuments.GetFakeOvalSystemCharacteristics("system_characteristics_with_local_variable.xml"); Assert.IsNotNull(systemSystemCharacteristics); VariablesTypeVariableLocal_variable localVariable = new VariablesTypeVariableLocal_variable() { id = "oval:org.mitre.oval:var:5000" }; VariableComponentType variableComponent = new VariableComponentType() { var_ref = "oval:org.mitre.oval:var:4000" }; LocalVariableVariablesComponent variableComponentEvaluator = new LocalVariableVariablesComponent(localVariable,variableComponent, definitions.variables, systemSystemCharacteristics); IEnumerable<string> values = variableComponentEvaluator.GetValue(); Assert.IsTrue(values.Count() > 0, "the quantity of value is not expected"); Assert.IsTrue(values.ElementAt(0) == @"Software\Microsoft\Windows NT\CurrentVersion", "the value is not expected"); }