public void Should_be_possible_to_create_objectTypes_by_combination_of_entities() { oval_definitions definition = new LoadOvalDocument().GetFakeOvalDefinitions("definitionsSimple.xml"); ObjectType objecType = ProbeHelper.GetOvalComponentByOvalID(definition, "oval:modulo:obj:7"); IEnumerable<string> paths = new List<string>() { @"c:\temp", @"c:\windows\temp",@"c:\teste" }; IEnumerable<string> fileNames = new List<string>() { "file.txt" }; IEnumerable<string> trustee_names = new List<string>() { "Administrator" }; FileEffectiveRightsObjectTypeFactory factory = new FileEffectiveRightsObjectTypeFactory(); IEnumerable<ObjectType> objectTypes = factory.CreateObjectTypeByCombinationOfEntities((fileeffectiverights_object)objecType, paths, fileNames, trustee_names); Assert.AreEqual(3, objectTypes.Count()); fileeffectiverights_object fileEffectiveRights = (fileeffectiverights_object)objectTypes.ElementAt(0); Assert.AreEqual(@"c:\temp", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.path)).Value); Assert.AreEqual("file.txt", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.filename)).Value); Assert.AreEqual("Administrator", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.trustee_name)).Value); fileEffectiveRights = (fileeffectiverights_object)objectTypes.ElementAt(1); Assert.AreEqual(@"c:\windows\temp", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.path)).Value); Assert.AreEqual("file.txt", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.filename)).Value); Assert.AreEqual("Administrator", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.trustee_name)).Value); fileEffectiveRights = (fileeffectiverights_object)objectTypes.ElementAt(2); Assert.AreEqual(@"c:\teste", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.path)).Value); Assert.AreEqual("file.txt", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.filename)).Value); Assert.AreEqual("Administrator", ((EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.trustee_name)).Value); }
public IEnumerable<ObjectType> ProcessVariables(ObjectType objectType) { List<ObjectType> fileEffectiveRightObjects = new List<ObjectType>(); fileeffectiverights_object fileEffectiveRights = (fileeffectiverights_object)objectType; IEnumerable<string> fileNames = this.processVariablesFromEntity(fileEffectiveRights,fileeffectiverights_object_ItemsChoices.filename); IEnumerable<string> paths = this.processVariablesFromEntity(fileEffectiveRights,fileeffectiverights_object_ItemsChoices.path); IEnumerable<string> trustee_names = this.processVariablesFromEntity(fileEffectiveRights, fileeffectiverights_object_ItemsChoices.trustee_name); if (this.IsVariablesWasProcessed(fileEffectiveRights,fileNames, paths, trustee_names)) { FileEffectiveRightsObjectTypeFactory factory = new FileEffectiveRightsObjectTypeFactory(); var objectTypes = factory.CreateObjectTypeByCombinationOfEntities(fileEffectiveRights, paths, fileNames, trustee_names); fileEffectiveRightObjects.AddRange(objectTypes); } return fileEffectiveRightObjects; }
public IEnumerable <ObjectType> ProcessVariables(ObjectType objectType) { List <ObjectType> fileEffectiveRightObjects = new List <ObjectType>(); fileeffectiverights_object fileEffectiveRights = (fileeffectiverights_object)objectType; IEnumerable <string> fileNames = this.processVariablesFromEntity(fileEffectiveRights, fileeffectiverights_object_ItemsChoices.filename); IEnumerable <string> paths = this.processVariablesFromEntity(fileEffectiveRights, fileeffectiverights_object_ItemsChoices.path); IEnumerable <string> trustee_names = this.processVariablesFromEntity(fileEffectiveRights, fileeffectiverights_object_ItemsChoices.trustee_name); if (this.IsVariablesWasProcessed(fileEffectiveRights, fileNames, paths, trustee_names)) { FileEffectiveRightsObjectTypeFactory factory = new FileEffectiveRightsObjectTypeFactory(); var objectTypes = factory.CreateObjectTypeByCombinationOfEntities(fileEffectiveRights, paths, fileNames, trustee_names); fileEffectiveRightObjects.AddRange(objectTypes); } return(fileEffectiveRightObjects); }