コード例 #1
0
ファイル: FilterEvaluator.cs プロジェクト: ywcsz/modSIC
 private void AddObjectTypeInList(sc.ObjectType objectType, List<sc.ObjectType> objectTypes)
 {
     sc.ObjectType existingObjectType = objectTypes.Where(obj => obj.id == objectType.id).SingleOrDefault();
     if (existingObjectType == null)
     {
         objectTypes.Add(objectType);
     }
 }
コード例 #2
0
ファイル: SelectedProbe.cs プロジェクト: jonaslsl/modSIC
        public ProbeResult Execute(IList<IConnectionProvider> connectionContext, 
                                   TargetInfo target, VariablesEvaluated variables,  
                                   SC::oval_system_characteristics  systemCharacteristics,
                                   IEnumerable<StateType> states)
        {
            CollectInfo collectInfo = new CollectInfo() 
            { 
                ObjectTypes = this.ObjectTypes, 
                Variables = variables, 
                SystemCharacteristics =  systemCharacteristics,
                States = states
            };

            return probe.Execute(connectionContext, target, collectInfo);
        }
コード例 #3
0
ファイル: FilterEvaluator.cs プロジェクト: jonaslsl/modSIC
 private List<sc.ObjectType> ApplyFilterInObjectType(string filterValue, sc.ObjectType objectType)
 {
     List<sc.ObjectType> objectTypesAfterFilter = new List<sc.ObjectType>();
     IEnumerable<string> referenceIds = objectType.GetReferenceTypesInString();
     foreach (string id in referenceIds)
     {
         ItemType itemType = this.systemCharacteristics.GetSystemDataByReferenceId(id);
         StateType state = this.GetStateById(filterValue);
         StateTypeComparator comparator = new StateTypeComparator(state, itemType,this.variables);
         if (!comparator.IsEquals())
         {
             this.AddObjectTypeInList(objectType, objectTypesAfterFilter);
         }
     }
     return objectTypesAfterFilter;
 }
コード例 #4
0
 private void AssertCollectedItemStatus(SysCharacteristics.ReferenceType objectReference, ItemType collectedItem)
 {
     Assert.IsInstanceOfType(collectedItem, typeof(textfilecontent_item), "The generated ItemType must be a instance of textfilecontent_item class.");
     Assert.AreEqual(objectReference.item_ref, collectedItem.id, "The generated ItemType ID must be equal to collected object ID.");
     Assert.AreEqual(StatusEnumeration.exists, collectedItem.status, "A generated ItemType with unexpected OVAL Status was found.");
 }
コード例 #5
0
        private void assertFileEffectiveRightsInitialEntities(Definitions.ObjectType sourceObject, SystemCharacteristics.ItemType collectedItem)
        {
            fileeffectiverights_item collectedFileEffectiveRightsItem = (fileeffectiverights_item)collectedItem;   
            
            var allExpectedEntities = OvalHelper.GetFileEffectiveRightsFromObjectType((fileeffectiverights_object)sourceObject);
            
            string expectedPath = allExpectedEntities[fileeffectiverights_object_ItemsChoices.path.ToString()].Value;
            string expectedFileName = allExpectedEntities[fileeffectiverights_object_ItemsChoices.filename.ToString()].Value;
            string expectedTrusteeName = allExpectedEntities[fileeffectiverights_object_ItemsChoices.trustee_name.ToString()].Value;

            Assert.AreEqual(expectedPath, collectedFileEffectiveRightsItem.path.Value, string.Format(MSG_UNEXPECTED_COLLECTED_ITEM_VALUE, "path"));
            Assert.AreEqual(expectedFileName, collectedFileEffectiveRightsItem.filename.Value, string.Format(MSG_UNEXPECTED_COLLECTED_ITEM_VALUE, "filename"));
            Assert.AreEqual(expectedTrusteeName, collectedFileEffectiveRightsItem.trustee_name.Value, string.Format(MSG_UNEXPECTED_COLLECTED_ITEM_VALUE, "trustee_name"));
        }