コード例 #1
0
        public void Should_be_possible_to_evaluate_variables_for_userSID55Object()
        {
            var fakeObjectType = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple.xml", "oval:modulo:obj:1090");
            var fakeVariablesEvaluated = VariableHelper.CreateVariableWithOneValue(fakeObjectType.id, ((user_sid55_object)fakeObjectType).UserSID.var_ref, "S-1-11");
            var variableEvaluator = new UserSID55EntityVariableEvaluator(fakeObjectType, fakeVariablesEvaluated);

            var variableEvaluationResult = variableEvaluator.ProcessVariableForAllObjectEntities().ToArray();

            this.AssertVariableEvaluation(variableEvaluationResult, new string[] { "S-1-11" } );
        }
コード例 #2
0
        public void VariableEvaluation_should_be_return_null_when_there_is_no_referenced_variable()
        {
            var fakeObjectType = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple.xml", "oval:modulo:obj:1090");
            var fakeVariablesEvaluated = VariableHelper.CreateEmptyEvaluatedVariables();
            var variableEvaluator = new UserSID55EntityVariableEvaluator(fakeObjectType, fakeVariablesEvaluated);

            var variableEvaluationResult = variableEvaluator.ProcessVariableForAllObjectEntities();

            Assert.IsNull(variableEvaluationResult, "The result of variable evaluation must be NULL.");
        }
コード例 #3
0
        private IEnumerable <String> processVariables(Definitions.ObjectType objectType, VariablesEvaluated variables)
        {
            var  userSIDEntity = ((user_sid55_object)objectType).UserSID;
            bool thereIsNoEvaluatedVariable = ((variables == null) || (variables.VariableValues.Count() == 0));

            if (thereIsNoEvaluatedVariable && (string.IsNullOrEmpty(userSIDEntity.var_ref)))
            {
                return(new List <String>(new string[] { userSIDEntity.Value }));
            }

            var variableEvaluator  = new UserSID55EntityVariableEvaluator(objectType, variables);
            var processedVariables = variableEvaluator.ProcessVariableForAllObjectEntities();

            return((processedVariables == null) ? null : processedVariables);
        }
コード例 #4
0
        private IEnumerable<String> processVariables(Definitions.ObjectType objectType, VariablesEvaluated variables)
        {
            var userSIDEntity = ((user_sid55_object)objectType).UserSID;
            bool thereIsNoEvaluatedVariable = ((variables == null) || (variables.VariableValues.Count() == 0));

            if (thereIsNoEvaluatedVariable && (string.IsNullOrEmpty(userSIDEntity.var_ref)))
                return new List<String>(new string[] { userSIDEntity.Value });

            var variableEvaluator = new UserSID55EntityVariableEvaluator(objectType, variables);
            var processedVariables = variableEvaluator.ProcessVariableForAllObjectEntities();
            return (processedVariables == null) ? null : processedVariables;
        }