public void Should_be_possible_to_get_value_of_a_constant_variable() { VariablesTypeVariableConstant_variable variable = this.CreateAConstantVariableWithASingleValue(); ConstantVariableEvaluator constantVariable = new ConstantVariableEvaluator(variable); IEnumerable <string> values = constantVariable.GetValue(); Assert.IsNotNull(values, "the valueToMatch of variable is null"); Assert.IsTrue(values.Count() == 1, "the quantity of values is not expected"); Assert.IsTrue(values.ElementAt <string>(0).Equals(KEY_OF_REGISTRY), "the valueToMatch is not expected"); }
private VariablesTypeVariableConstant_variable CreateAConstantVariableWithASingleValue() { VariablesTypeVariableConstant_variable variable = new VariablesTypeVariableConstant_variable(); variable.id = "oval:org.mitre.oval:var:932"; variable.datatype = SimpleDatatypeEnumeration.@string; variable.version = "1"; Modulo.Collect.OVAL.Definitions.ValueType[] values = new Modulo.Collect.OVAL.Definitions.ValueType[1]; Modulo.Collect.OVAL.Definitions.ValueType value = new Modulo.Collect.OVAL.Definitions.ValueType(); values[0] = value; variable.value = values; value.Value = KEY_OF_REGISTRY; return(variable); }
private VariablesTypeVariableConstant_variable CreateAConstantVariableWithAListOfValues() { VariablesTypeVariableConstant_variable variable = new VariablesTypeVariableConstant_variable(); variable.id = "oval:org.mitre.oval:var:932"; variable.datatype = SimpleDatatypeEnumeration.@string; variable.version = "1"; Modulo.Collect.OVAL.Definitions.ValueType[] values = new Modulo.Collect.OVAL.Definitions.ValueType[3]; Modulo.Collect.OVAL.Definitions.ValueType value1 = new Modulo.Collect.OVAL.Definitions.ValueType(); Modulo.Collect.OVAL.Definitions.ValueType value2 = new Modulo.Collect.OVAL.Definitions.ValueType(); Modulo.Collect.OVAL.Definitions.ValueType value3 = new Modulo.Collect.OVAL.Definitions.ValueType(); value1.Value = KEY_OF_REGISTRY; value2.Value = KEY_OF_REGISTRY_WINDOWS; value3.Value = KEY_OF_REGISTRY_WINDOWS_TEMP; values[0] = value1; values[1] = value2; values[2] = value3; variable.value = values; return(variable); }
public ConstantVariableEvaluator(VariablesTypeVariableConstant_variable variable) { this.variable = variable; }