Exemplo n.º 1
0
        public void Should_be_possible_to_collect_a_GroupSIDObject()
        {
            var groupSIDProber = new GroupSIDProber();
            ProberBehaviorCreator
                .CreateBehaviorForNormalFlowExecution(
                    groupSIDProber, 
                    FakeItemsToReturnByItemTypeGenerator,
                    FakeCollectedItems);

            var probeExecutionResult = groupSIDProber.Execute(FakeContext, FakeTargetInfo, FakeCollectInfo);
            DoAssertForSingleCollectedObject(probeExecutionResult, typeof(group_sid_item));

            var collectedItem = (group_sid_item)probeExecutionResult.CollectedObjects.Single().SystemData.Single();
            Assert.AreEqual("S-1-32", collectedItem.group_sid.Value);
            Assert.AreEqual(2, collectedItem.user_sid.Count());
            Assert.AreEqual("S-1-0", collectedItem.user_sid.ElementAt(0).Value);
            Assert.AreEqual("S-1-1", collectedItem.user_sid.ElementAt(1).Value);
        }
Exemplo n.º 2
0
        public void If_any_occurs_while_item_type_creation_an_item_with_error_status_must_be_returned()
        {
            var groupSIDProber = new GroupSIDProber();
            ProberBehaviorCreator.CreateBehaviorWithExceptionThrowing(groupSIDProber);

            var probeExecutionResult = groupSIDProber.Execute(FakeContext, FakeTargetInfo, FakeCollectInfo);

            DoAssertForExecutionWithErrors(probeExecutionResult, typeof(group_sid_item));
        }
Exemplo n.º 3
0
        public void Should_be_possible_to_collect_a_GroupSIDObject_with_SET_element_defined()
        {
            var objectTypes = new Definitions.ObjectType[] { ProbeHelper.GetDefinitionObjectTypeByID("definitionsWithSet.xml", "oval:modulo:obj:1000") };
            var fakeSystemCharacteristics = ProbeHelper.GetOvalSystemCharacteristicsFromFile("system_characteristics_with_sets.xml");
            var fakeCollectInfo = ProbeHelper.CreateFakeCollectInfo(objectTypes, null, fakeSystemCharacteristics);
            var fakeCollectedItem = ProbeHelper.CreateFakeCollectedItem(this.CreateFakeGroupSIDItemType());
            var groupSIDProber = new GroupSIDProber();
            ProberBehaviorCreator
                .CreateBehaviorForNormalFlowExecution(
                    groupSIDProber,
                    null,
                    new CollectedItem[] { fakeCollectedItem });

            var probeExecutionResult = groupSIDProber.Execute(FakeContext, FakeTargetInfo, fakeCollectInfo);

            Assert.IsNotNull(probeExecutionResult);
            Assert.AreEqual(1, probeExecutionResult.CollectedObjects.Count());

            var collectedObject = probeExecutionResult.CollectedObjects.ElementAt(0).ObjectType;
            Assert.AreEqual("oval:modulo:obj:1000", collectedObject.id);
            Assert.AreEqual(FlagEnumeration.complete, collectedObject.flag);
            Assert.AreEqual(2, collectedObject.reference.Count());
            Assert.AreEqual("1001", collectedObject.reference.ElementAt(0).item_ref);
            Assert.AreEqual("1002", collectedObject.reference.ElementAt(1).item_ref);

            var collectedItems = probeExecutionResult.CollectedObjects.ElementAt(0).SystemData;
            Assert.AreEqual(2, collectedItems.Count);
            var firstItem = (group_sid_item)collectedItems.ElementAt(0);
            this.AssertCollectedItem(firstItem, "1001", "S-1-5-32-500", new string[] { "S-1-5-32-500-1", "S-1-5-32-500-2" });
            var secondItem = (group_sid_item)collectedItems.ElementAt(1);
            this.AssertCollectedItem(secondItem, "1002", "S-1-5-32-501", new string[] { "S-1-5-32-501-1", "S-1-5-32-501-2" });
        }