コード例 #1
0
        /// <summary>
        /// this method returns the item_types to collect. 
        /// </summary>
        /// <param name="objectType">Type of the object.</param>
        /// <returns></returns>
        public virtual IEnumerable<ItemType> GetItemsToCollect(Definitions.ObjectType objectType, VariablesEvaluated variables)
        {
            var variableEvaluator = new RegistryEntityVariableEvaluator(variables);
            var operationEvaluator = new RegistryEntityOperationEvaluator(this.SystemDataSource, this.WmiDataProvider);
                        
            var registryObjectsVariableProcessed = variableEvaluator.ProcessVariableForRegistryObject((registry_object)objectType);
            var registryObjectsOperationProcessed = operationEvaluator.ProcessOperation(registryObjectsVariableProcessed);

            return registryObjectsOperationProcessed;
        }        
コード例 #2
0
        public void Should_be_possible_to_get_a_registryObject_with_his_variables_processed()
        {
            oval_definitions definitions = ProbeHelper.GetFakeOvalDefinitions(DEFINITIONS_WITH_CONST_VARIABLES);
            registry_object ovalRegistryObject = (registry_object)ProbeHelper.GetOvalComponentByOvalID(definitions, OBJ_3000_ID);
            Assert.IsNotNull(ovalRegistryObject, "the oval registry object is not exists in the fakeDefinitions");

            Dictionary<String, EntityObjectStringType> allRegistryEntities = OvalHelper.GetRegistryEntitiesFromObjectType(ovalRegistryObject);
            string expectedHiveValue = allRegistryEntities[registry_object_ItemsChoices.hive.ToString()].Value;
            string expectedNameValue = allRegistryEntities[registry_object_ItemsChoices.name.ToString()].Value;

            VariablesEvaluated variablesEvaluated = VariableHelper.CreateVariableWithOneValue(OBJ_3000_ID, VAR_3000_ID, VAR_3000_VALUE_1);
            RegistryEntityVariableEvaluator registryEntityVariableEvaluator = new RegistryEntityVariableEvaluator(variablesEvaluated);

            IEnumerable<RegistryObject> registries =  registryEntityVariableEvaluator.ProcessVariableForRegistryObject(ovalRegistryObject);

            Assert.AreEqual(1, registries.Count(), "the quantity of registries is not expected");
            Assert.AreEqual(expectedHiveValue, registries.ElementAt(0).Hive, "the hive value is not expected");
            Assert.AreEqual(VAR_3000_VALUE_1, registries.ElementAt(0).Key, "the key value is not expected");
            Assert.AreEqual(expectedNameValue, registries.ElementAt(0).Name, "the name value is not expected");
        }
コード例 #3
0
 public void Should_not_be_possible_to_create_a_RegistryEntityVariableEvaluator_with_a_null_VariableEvaluator()
 {
     RegistryEntityVariableEvaluator registryEntityVariableEvaluator = new RegistryEntityVariableEvaluator(null);
 }