public void Should_be_possible_to_process_path_entity_that_contains_a_reference_to_a_variable_with_multi_values()
        {
            string[] var1001Values =
                new string[] { "c:\\windows\\system32", "c:\\windows\\system", "c:\\windows\\drivers" };

            file_object        fileObject1001 = this.GetFileObjectToTest(DEFINITIONS_WITH_CONST_VARIABLE, "1001");
            VariablesEvaluated vars           = VariableHelper.CreateVariableWithMultiplesValue(fileObject1001.id, VAR_1001_ID, var1001Values);
            string             filename       = this.getFileNameEntityValueFromFileObject(fileObject1001);


            FileEntityVariableEvaluator fileVariableEvaluator = new FileEntityVariableEvaluator(vars);
            IEnumerable <ObjectType>    derivedEntitites      = fileVariableEvaluator.ProcessVariables(fileObject1001);

            Assert.IsNotNull(derivedEntitites);
            Assert.AreEqual(3, derivedEntitites.Count());

            file_object fileObject = (file_object)derivedEntitites.ElementAt(0);

            Assert.AreEqual("c:\\windows\\system32", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("inetcomm.dll", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);

            fileObject = (file_object)derivedEntitites.ElementAt(1);
            Assert.AreEqual("c:\\windows\\system", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("inetcomm.dll", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);

            fileObject = (file_object)derivedEntitites.ElementAt(2);
            Assert.AreEqual("c:\\windows\\drivers", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("inetcomm.dll", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
        }
        public void Should_be_possible_to_process_path_entity_that_contains_a_reference_to_a_variable()
        {
            file_object        fileObject1001 = this.GetFileObjectToTest(DEFINITIONS_WITH_CONST_VARIABLE, "1001");
            VariablesEvaluated vars           = VariableHelper.CreateVariableWithOneValue(fileObject1001.id, VAR_1001_ID, "c:\\windows\\system32");

            FileEntityVariableEvaluator fileVariableEvaluator = new FileEntityVariableEvaluator(vars);
            //IEnumerable<string> derivedEntitites = fileVariableEvaluator.ProcessVariableForAllObjectEntities();
            IEnumerable <ObjectType> derivedEntities = fileVariableEvaluator.ProcessVariables(fileObject1001);

            Assert.IsNotNull(derivedEntities);

            file_object fileObject = (file_object)derivedEntities.ElementAt(0);

            Assert.AreEqual(1, derivedEntities.Count());
            Assert.AreEqual("c:\\windows\\system32", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("inetcomm.dll", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
        }
        public void Should_be_possible_to_process_variable_from_fileObject_and_keep_the_operation_info_in_object_type()
        {
            file_object        fileObject1004 = this.GetFileObjectToTest(DEFINITIONS_WITH_CONST_VARIABLE, "1004");
            VariablesEvaluated vars           = VariableHelper.CreateVariableWithOneValue(fileObject1004.id, VAR_1001_ID, "c:\\windows\\system32");

            FileEntityVariableEvaluator fileVariableEvaluator = new FileEntityVariableEvaluator(vars);
            IEnumerable <ObjectType>    derivedEntities       = fileVariableEvaluator.ProcessVariables(fileObject1004);

            Assert.IsNotNull(derivedEntities);

            file_object fileObject = (file_object)derivedEntities.ElementAt(0);

            Assert.AreEqual(1, derivedEntities.Count());
            Assert.AreEqual("c:\\windows\\system32", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("file.txt", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
            Assert.AreEqual(OperationEnumeration.notequal, ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).operation);
        }
        public void Should_be_possible_to_process_filepath_entity_that_contains_a_reference_to_a_variable_with_multi_values()
        {
            string[]           fakeVariableValues = new string[] { "c:\\temp\\file1.txt", "c:\\temp\\file2.txt" };
            file_object        fileObject1002     = this.GetFileObjectToTest(DEFINITIONS_WITH_CONST_VARIABLE, "1002");
            VariablesEvaluated vars = VariableHelper.CreateVariableWithMultiplesValue(fileObject1002.id, VAR_1002_ID, fakeVariableValues);


            FileEntityVariableEvaluator fileVariableEvaluator = new FileEntityVariableEvaluator(vars);
            IEnumerable <ObjectType>    derivedEntitites      = fileVariableEvaluator.ProcessVariables(fileObject1002);

            Assert.IsNotNull(derivedEntitites);
            Assert.AreEqual(2, derivedEntitites.Count());

            file_object fileObject = (file_object)derivedEntitites.ElementAt(0);

            Assert.AreEqual("c:\\temp\\file1.txt", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filepath)).Value);

            fileObject = (file_object)derivedEntitites.ElementAt(1);
            Assert.AreEqual("c:\\temp\\file2.txt", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filepath)).Value);
        }
        public void Should_be_possible_to_process_fileObject_where_all_entities_have_referenced_multi_values_variables()
        {
            Dictionary <string, IEnumerable <string> > fakeVariablesValues = new Dictionary <string, IEnumerable <string> >();

            fakeVariablesValues.Add(VAR_1001_ID, new string[] { "c:\\tmp", "c:\\temp" });
            fakeVariablesValues.Add(VAR_1002_ID, new string[] { "file1.txt", "file2.ext", "file3.exe" });

            file_object        fileObject1003         = this.GetFileObjectToTest(DEFINITIONS_WITH_CONST_VARIABLE, "1003");
            VariablesEvaluated fakeEvaluatedVariables = VariableHelper.CreateEvaluatedVariables(fileObject1003.id, fakeVariablesValues);


            FileEntityVariableEvaluator fileVariableEvaluator = new FileEntityVariableEvaluator(fakeEvaluatedVariables);
            IEnumerable <ObjectType>    derivedEntitites      = fileVariableEvaluator.ProcessVariables(fileObject1003);

            Assert.IsNotNull(derivedEntitites);
            Assert.AreEqual(6, derivedEntitites.Count(), "The number of created entities is not expected.");

            file_object fileObject = (file_object)derivedEntitites.ElementAt(0);

            Assert.AreEqual(@"c:\tmp", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("file1.txt", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
            fileObject = (file_object)derivedEntitites.ElementAt(1);
            Assert.AreEqual(@"c:\tmp", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("file2.ext", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
            fileObject = (file_object)derivedEntitites.ElementAt(2);
            Assert.AreEqual(@"c:\tmp", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("file3.exe", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
            fileObject = (file_object)derivedEntitites.ElementAt(3);
            Assert.AreEqual(@"c:\temp", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("file1.txt", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
            fileObject = (file_object)derivedEntitites.ElementAt(4);
            Assert.AreEqual(@"c:\temp", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("file2.ext", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
            fileObject = (file_object)derivedEntitites.ElementAt(5);
            Assert.AreEqual(@"c:\temp", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.path)).Value);
            Assert.AreEqual("file3.exe", ((EntityObjectStringType)fileObject.GetItemValue(file_object_ItemsChoices.filename)).Value);
        }