Esempio n. 1
0
        private List <LocalVariableComponent> GetLocalVariableComponentList(oval_system_characteristics systemCharacteristics)
        {
            var components       = new List <LocalVariableComponent>();
            var literalComponent = new LiteralComponentType()
            {
                Value = @"\"
            };
            var objectComponent1 = new ObjectComponentType()
            {
                object_ref = "oval:org.mitre.oval:obj:5000", item_field = "name"
            };
            var objectComponent2 = new ObjectComponentType()
            {
                object_ref = "oval:org.mitre.oval:obj:6000", item_field = "name"
            };

            var objectComponentEvaluator1 = new  LocalVariableObjectComponent(objectComponent1, systemCharacteristics);
            var literalComponentEvaluator = new LocalVariableLiteralComponent(literalComponent);
            var objectComponentEvaluator2 = new  LocalVariableObjectComponent(objectComponent2, systemCharacteristics);

            components.Add(objectComponentEvaluator1);
            components.Add(literalComponentEvaluator);
            components.Add(objectComponentEvaluator2);

            return(components);
        }
Esempio n. 2
0
        public OvalSubstringBuilder AddLiteralComponent(string value)
        {
            LiteralComponentType literalComponent = new LiteralComponentType()
            {
                Value = value, datatype = SimpleDatatypeEnumeration.@string
            };

            this.substringFunction.Item = literalComponent;
            return(this);
        }
Esempio n. 3
0
        public OvalArithmeticBuilder AddLiteralComponent(string value, SimpleDatatypeEnumeration type)
        {
            LiteralComponentType literalComponent = new LiteralComponentType()
            {
                Value = value, datatype = type
            };

            items.Add(literalComponent);
            return(this);
        }
Esempio n. 4
0
        public OvalEndBuilder AddLiteralComponent(string value)
        {
            LiteralComponentType literalComponent = new LiteralComponentType()
            {
                Value = value
            };

            endFunciton.Item = literalComponent;
            return(this);
        }
Esempio n. 5
0
        public OvalBeginBuilder AddLiteralComponent(string value)
        {
            LiteralComponentType literalComponent = new LiteralComponentType()
            {
                Value = value
            };

            beginFunction.Item = literalComponent;
            return(this);
        }
Esempio n. 6
0
        public OvalSplitBuilder AddLiteralComponent(string value)
        {
            LiteralComponentType literalComponentType = new LiteralComponentType()
            {
                Value = value, datatype = SimpleDatatypeEnumeration.@string
            };

            splitFunctionType.Item = literalComponentType;
            return(this);
        }
Esempio n. 7
0
        public OvalEscapeRegexBuilder AddLiteralComponent(string value)
        {
            LiteralComponentType literalComponent = new LiteralComponentType()
            {
                Value = value
            };

            this.escapeRegexFunction.Item = literalComponent;
            return(this);
        }
Esempio n. 8
0
        public OvalCountBuilder AddLiteralComponent(string value)
        {
            LiteralComponentType literalComponent = new LiteralComponentType()
            {
                Value = value
            };

            this.items.Add(literalComponent);
            return(this);
        }
        public void Should_be_possible_to_get_value_of_an_LiteralComponentType()
        {
            oval_definitions definitions = new OvalDocumentLoader().GetFakeOvalDefinitions("definitionsWithLocalVariable.xml");

            Assert.IsNotNull(definitions, "the definitions is null");

            LiteralComponentType literalComponent = new LiteralComponentType()
            {
                datatype = Modulo.Collect.OVAL.Common.SimpleDatatypeEnumeration.@string,
                Value    = @"\System32"
            };

            LocalVariableLiteralComponent literalVariable = new LocalVariableLiteralComponent(literalComponent);
            IEnumerable <string>          values          = literalVariable.GetValue();

            Assert.IsTrue(values.Count() > 0, "the quantity of values is not expected");
            Assert.IsTrue(values.ElementAt(0) == @"\System32", "the value is not expected");
        }
        private VariablesTypeVariableLocal_variable GetLocalVariableForAddOperationWithLiteralComponentTypeInt()
        {
            LiteralComponentType literalComponent1 = new LiteralComponentType()
            {
                Value = 10.ToString(), datatype = SimpleDatatypeEnumeration.@int
            };
            LiteralComponentType literalComponent2 = new LiteralComponentType()
            {
                Value = 10.ToString(), datatype = SimpleDatatypeEnumeration.@int
            };
            ArithmeticFunctionType arithmeticFunctionType = new ArithmeticFunctionType()
            {
                arithmetic_operation = ArithmeticEnumeration.add, Items = new [] { literalComponent1, literalComponent2 }
            };
            VariablesTypeVariableLocal_variable localVariable = new VariablesTypeVariableLocal_variable()
            {
                Item = arithmeticFunctionType
            };

            return(localVariable);
        }
 public LocalVariableLiteralComponent(LiteralComponentType literalComponent)
 {
     this.literalComponent = literalComponent;
 }
 public LocalVariableLiteralComponent(LiteralComponentType literalComponent)
 {
     this.literalComponent = literalComponent;
 }