Example #1
0
 public void Should_be_possible_to_compare_the_state_of_itemType()
 {
     ItemType itemType = this.systemCharacteristics.GetSystemDataByReferenceId("3");
     StateType state = this.states.Where(obj => obj.id == "oval:org.mitre.oval:ste:99").SingleOrDefault();
     StateTypeComparator comparator = new StateTypeComparator(state,itemType,null);
     Assert.AreEqual(true, comparator.IsEquals());
 }
        public void Should_not_possible_to_evaluate_variables_that_has_multiples_values()
        {
            List<string> values = new List<string>() { "1.0","1.1","1.2" };
            VariableValue variable = new VariableValue("oval:org.mitre.oval:obj:3000", "oval:org.mitre.oval:var:3000", values);
            VariablesEvaluated variables = new VariablesEvaluated(new List<VariableValue>() { variable });
            ItemType itemType = this.systemCharacteristics.GetSystemDataByReferenceId("3");
            StateType state = this.states.Where(obj => obj.id == "oval:org.mitre.oval:ste:100").SingleOrDefault();
            StateTypeComparator comparator = new StateTypeComparator(state, itemType, variables);
            comparator.IsEquals();

        }
Example #3
0
 private List<sc.ObjectType> ApplyFilterInObjectType(string filterValue, sc.ObjectType objectType)
 {
     List<sc.ObjectType> objectTypesAfterFilter = new List<sc.ObjectType>();
     IEnumerable<string> referenceIds = objectType.GetReferenceTypesInString();
     foreach (string id in referenceIds)
     {
         ItemType itemType = this.systemCharacteristics.GetSystemDataByReferenceId(id);
         StateType state = this.GetStateById(filterValue);
         StateTypeComparator comparator = new StateTypeComparator(state, itemType,this.variables);
         if (!comparator.IsEquals())
         {
             this.AddObjectTypeInList(objectType, objectTypesAfterFilter);
         }
     }
     return objectTypesAfterFilter;
 }
Example #4
0
        private ResultEnumeration ExecuteStateComparator(ItemType collectedItem, StateType state, VariablesEvaluated evaluatedVariables)
        {
            try
            {
                var stateComparator = new StateTypeComparator(state, collectedItem, evaluatedVariables);
                if (stateComparator.IsEquals())
                    return ResultEnumeration.@true;

                return ResultEnumeration.@false;
            }
            catch (NotSupportedException)
            {
                return ResultEnumeration.unknown;
            }
        }