public void Should_be_possible_generate_items_to_collect_from_a_GroupSIDObject_with_PatternMatchOperation() { var allGroupSIDsFakeToReturn = new string[] { "S-1-1", "S-1-18", @"S-1-5-32-100", @"S-1-5-32-500", @"S-1-5-32-999", "S-1-0" }; var objectToCollect = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple.xml", "oval:modulo:obj:1113"); GroupSIDItemTypeGenerator mockedItemTypeGenerator = this.CreateMockedGroupSIDItemTypeGenerator(allGroupSIDsFakeToReturn); var generatedItems = mockedItemTypeGenerator.GetItemsToCollect(objectToCollect, null); this.DoBasicAssert(generatedItems, 3); this.AssertGeneratedItemsToCollect(generatedItems, new string[] { "S-1-5-32-100", "S-1-5-32-500", "S-1-5-32-999" }); }
public void Should_be_possible_generate_items_to_collect_from_a_GroupSIDObject_with_NotEqualOperation_and_referenced_variable() { var allGroupSIDsFakeToReturn = new string[] { @"S-1-1-18", "S-1-1", @"S-1-0" }; var objectToCollect = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple.xml", "oval:modulo:obj:1114"); var fakeEvaluatedVariables = VariableHelper.CreateVariableWithOneValue(objectToCollect.id, "oval:modulo:var:1001", "S-1-1"); GroupSIDItemTypeGenerator mockedItemTypeGenerator = this.CreateMockedGroupSIDItemTypeGenerator(allGroupSIDsFakeToReturn); var generatedItems = mockedItemTypeGenerator.GetItemsToCollect(objectToCollect, fakeEvaluatedVariables); this.DoBasicAssert(generatedItems, 2); this.AssertGeneratedItemsToCollect(generatedItems, new string[] { "S-1-1-18", "S-1-0" }); }
public void Should_be_possible_generate_items_to_collect_from_a_default_GroupSidObject() { var objectToCollect = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple.xml", "oval:modulo:obj:1110"); var itemTypeGenerator = new GroupSIDItemTypeGenerator() { TargetInfo = FakeTargetInfo }; var generatedItems = itemTypeGenerator.GetItemsToCollect(objectToCollect, null); this.DoBasicAssert(generatedItems, 1); this.AssertGeneratedItemsToCollect(generatedItems, new string[] { "S-1-5-32-544" }); }
public void Should_be_possible_generate_items_to_collect_from_a_GroupSidObject_with_referenced_to_a_MultiValuedVariable() { var fakeMultiVaribleValues = new string[] { "S-1-5", "S-1-5-18" }; var objectToCollect = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple.xml", "oval:modulo:obj:1112"); var fakeEvaluatedVars = VariableHelper.CreateVariableWithMultiplesValue(objectToCollect.id, "oval:modulo:var:831", fakeMultiVaribleValues); var itemTypeGenerator = new GroupSIDItemTypeGenerator() { TargetInfo = FakeTargetInfo }; var generatedItems = itemTypeGenerator.GetItemsToCollect(objectToCollect, fakeEvaluatedVars); this.DoBasicAssert(generatedItems, 2); }
public void Should_be_possible_generate_items_to_collect_from_a_GroupSidObject_with_referenced_variable() { var objectToCollect = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple.xml", "oval:modulo:obj:1111"); var fakeEvaluatedVariables = VariableHelper.CreateVariableWithOneValue(objectToCollect.id, "oval:modulo:var:201", "S-1-5-18"); var itemTypeGenerator = new GroupSIDItemTypeGenerator() { TargetInfo = FakeTargetInfo }; var generatedItems = itemTypeGenerator.GetItemsToCollect(objectToCollect, fakeEvaluatedVariables); this.DoBasicAssert(generatedItems, 1); Assert.AreEqual("S-1-5-18", ((group_sid_item)generatedItems.First()).group_sid.Value, "An unexpected item entity was found."); }