public void Should_be_possible_to_generate_smf_items_to_collect() { // Arrange var smfObjectSample = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "2500"); var itemsGenerator = new SMFItemTypeGenerator(); // Act var generatedItems = itemsGenerator.GetItemsToCollect(smfObjectSample, null).ToArray(); // Assert ItemTypeChecker.DoBasicAssertForItems(generatedItems, 1, typeof(smf_item)); AssertSmfItem((smf_item)generatedItems.Single(), "disable svc:/network/rpc/bind:default"); }
public void Should_be_possible_to_generate_smf_items_from_an_object_with_referenced_variables() { // Arrange var smfObjectSample = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "2503"); var fakeVariables = VariableHelper.CreateVariableWithOneValue( "oval:modulo:obj:2503", "oval:modulo:var:2503", "enable svc:/network/rpc/bind:default"); var itemsGenerator = new SMFItemTypeGenerator(); // Act var generatedItems = itemsGenerator.GetItemsToCollect(smfObjectSample, fakeVariables).ToArray(); // Assert ItemTypeChecker.DoBasicAssertForItems(generatedItems, 1, typeof(smf_item)); AssertSmfItem((smf_item)generatedItems.Single(), "enable svc:/network/rpc/bind:default"); }
public void Should_be_possible_to_generate_smf_items_from_an_object_with_referenced_variables_that_multi_values() { var smfObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "2700"); string[] arrayVariables = new string[] {"disable svc:/network/rpc/bind:default", "enable svc:/network/rpc/bind:default"}; var fakeVariables = VariableHelper.CreateVariableWithMultiplesValue ("oval:modulo:obj:2700", "oval:modulo:var:2700", arrayVariables); var itemsGenerator = new SMFItemTypeGenerator().GetItemsToCollect(smfObject, fakeVariables).ToArray(); ItemTypeChecker.DoBasicAssertForItems(itemsGenerator, 2, typeof(smf_item)); AssertSmfItem((smf_item)itemsGenerator[0], "disable svc:/network/rpc/bind:default"); AssertSmfItem((smf_item)itemsGenerator[1], "enable svc:/network/rpc/bind:default"); }
public void Should_not_be_possible_generate_smf_items_from_an_object_with_pattern_match_operation_on_service_name_entity() { var smfObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "2900"); var fakeVariables = CreateFakeEvaluatedVariablesWithMultiValues("oval:modulo:obj:2900"); var generatedItems = new SMFItemTypeGenerator().GetItemsToCollect(smfObject, fakeVariables).ToArray(); ItemTypeChecker.DoBasicAssertForItems(generatedItems, 1, typeof(smf_item), StatusEnumeration.error); var generatedSmfItem = (smf_item)generatedItems.Single(); Assert.AreEqual(StatusEnumeration.error, generatedSmfItem.status, "The expected status is 'error'."); var fmriEntity = generatedSmfItem.fmri; Assert.IsNotNull(fmriEntity); Assert.AreEqual(StatusEnumeration.error, fmriEntity.status); Assert.IsNotNull(generatedSmfItem.message); Assert.AreEqual(MessageLevelEnumeration.error, generatedSmfItem.message.First().level); Assert.AreEqual("The 'patternmatch' operation is not supported for this entity.", generatedSmfItem.message.First().Value); }