Пример #1
0
 public TestType(Definitions.TestType test) : this()
 {
     this.test_id         = test.id;
     this.check           = test.check;
     this.check_existence = test.check_existence;
     this.state_operator  = test.state_operator;
     this.version         = test.version;
 }
Пример #2
0
        private bool IsThereReferenceStateForTest(Definitions.TestType test)
        {
            var testStateField = test.GetType().GetProperty("state");
            var testReference  = testStateField.GetValue(test, null) as StateRefType;

            if (testReference != null)
            {
                return(true);
            }

            var testReferenceArray = testStateField.GetValue(test, null) as StateRefType[];

            return(testReferenceArray != null);
        }
Пример #3
0
        public ResultEnumeration GetCheckStateResult(oval_results results, Definitions.TestType originalTest)
        {
            ResultEnumeration stateResult = ResultEnumeration.error;
            var itemsResults = new List <ResultEnumeration>();

            var testStates = ((originalTest.GetType().GetProperty("state")
                               .GetValue(originalTest, null) as StateRefType[]) ?? new StateRefType[] {}).Select(x => results.oval_definitions.states.SingleOrDefault(y => y.id == x.state_ref));

            foreach (var testedItem in tested_item)
            {
                var stateResults             = new List <ResultEnumeration>();
                var collectedItem            = results.results[0].oval_system_characteristics.system_data.SingleOrDefault(x => x.id == testedItem.item_id);
                ResultEnumeration itemResult = ResultEnumeration.notevaluated;

                if (collectedItem == null)
                {
                    itemResult = ResultEnumeration.notevaluated;
                }
                else
                {
                    foreach (var state in testStates)
                    {
                        var evaluatedVariables = CreateEvalutedVariablesFromStateType(state, results);
                        var tempResult         = ExecuteStateComparator(collectedItem, state, evaluatedVariables);
                        stateResults.Add(tempResult);
                    }

                    itemResult = oval_results.CombineResultsByOperator(stateResults, state_operator);
                }

                testedItem.result = itemResult;
                itemsResults.Add(itemResult);
            }
            stateResult = oval_results.CombineResultsByCheck(itemsResults, check);

            return(stateResult);
        }