Exemplo n.º 1
0
        public void When_some_error_occurred_during_item_type_generation_a_item_with_status_equals_to_error_must_be_returned()
        {
            var fakeObjectType  = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple.xml", "oval:modulo:obj:3");
            var fakeCollectInfo = ProbeHelper.CreateFakeCollectInfo(new Definitions.ObjectType[] { fakeObjectType }, null, null);
            var fileProber      = this.CreateMockedFileProber(null, null, new Exception("Test Exception"));

            var collectedObjects = fileProber.Execute(FakeContext, FakeTarget, fakeCollectInfo);

            WindowsTestHelper.AssertItemWithErrorStatus(collectedObjects.CollectedObjects.First().SystemData, typeof(file_item), "Test Exception");
        }
Exemplo n.º 2
0
        public void If_any_occurs_while_item_type_creation_an_item_with_error_status_must_be_returned()
        {
            var objectType      = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", OBJ_3000_ID);
            var fakeCollectInfo = ProbeHelper.CreateFakeCollectInfo(new Definitions.ObjectType[] { objectType }, null, null);
            var fakeException   = new Exception("Registry Access Denied");
            var registryProber  = this.CreateMockedProberWithGetItemsErrorBehavior(fakeException);

            var proberResult = registryProber.Execute(fakeContext, fakeTarget, fakeCollectInfo);

            Assert.IsNotNull(proberResult, "The result of probe execution cannot be null.");
            Assert.AreEqual(1, proberResult.CollectedObjects.Count());

            var collectedItems = proberResult.CollectedObjects.Single().SystemData;

            WindowsTestHelper.AssertItemWithErrorStatus(collectedItems, typeof(registry_item), fakeException.Message);
        }