Exemplo n.º 1
0
        public void Should_be_possible_to_collect_AccessTokenObject_with_SET_element_defined()
        {
            var accessTokenProber = new AccessTokenProber() { WMIConnectionProvider = GetMockedWmiConnectionProvider() };
            var fakeCollectInfoForSetElement = GetFakeCollectInfo("oval:modulo:obj:880");
            var fakeVariables = VariableHelper.CreateVariableWithOneValue("oval:modulo:obj:860", "oval:modulo:var:860", "ADMINISTRATOR");
            var fakeSystemCharacteristics = ProbeHelper.GetOvalSystemCharacteristicsFromFile("system_characteristics_with_sets.xml");
            fakeCollectInfoForSetElement.Variables = fakeVariables;
            fakeCollectInfoForSetElement.SystemCharacteristics = fakeSystemCharacteristics;
            ProberBehaviorCreator
                .CreateBehaviorForNormalFlowExecution(
                    accessTokenProber,
                    FakeItemsToCollect,
                    FakeCollectedItems);


            var proberExecutionResult = accessTokenProber.Execute(FakeContext, FakeTargetInfo, fakeCollectInfoForSetElement);

            Assert.IsNotNull(proberExecutionResult);
            Assert.IsNotNull(proberExecutionResult.CollectedObjects);
            Assert.AreEqual(1, proberExecutionResult.CollectedObjects.Count());
            
            var collectedObject = proberExecutionResult.CollectedObjects.Single();
            Assert.AreEqual(2, collectedObject.ObjectType.reference.Count());
            Assert.AreEqual(collectedObject.ObjectType.reference.Count(), collectedObject.SystemData.Count);

            Assert.AreEqual(collectedObject.ObjectType.reference.ElementAt(0).item_ref, collectedObject.SystemData.ElementAt(0).id);
            Assert.AreEqual(collectedObject.ObjectType.reference.ElementAt(1).item_ref, collectedObject.SystemData.ElementAt(1).id);

            Assert.IsInstanceOfType(collectedObject.SystemData.ElementAt(0), typeof(accesstoken_item));
            Assert.IsInstanceOfType(collectedObject.SystemData.ElementAt(1), typeof(accesstoken_item));
        }
Exemplo n.º 2
0
        public void Should_be_possible_to_collect_user_privileges_through_AccessTokenProber()
        {
            var accessTokenProber = new AccessTokenProber() { WMIConnectionProvider = GetMockedWmiConnectionProvider() };
            ProberBehaviorCreator
                .CreateBehaviorForNormalFlowExecution(
                    accessTokenProber,
                    FakeItemsToCollect,
                    FakeCollectedItems);

            ProbeResult result = accessTokenProber.Execute(FakeContext, FakeTargetInfo, FakeCollectInfo);

            DoAssertForSingleCollectedObject(result, typeof(accesstoken_item));
        }
Exemplo n.º 3
0
        public void When_an_error_occurs_while_creating_items_to_collect_the_created_items_must_have_error_status()
        {
            var accessTokenProber = new AccessTokenProber() { WMIConnectionProvider = GetMockedWmiConnectionProvider() };
            var fakeCollectInfo = GetFakeCollectInfo("oval:modulo:obj:860");
            ProberBehaviorCreator.CreateBehaviorWithExceptionThrowing(accessTokenProber);

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

            DoAssertForExecutionWithErrors(probeExecutionResult, typeof(accesstoken_item));
        }