public void Should_be_possible_to_collect_a_xmlfilecontent_item()
        {
            //<xmlfilecontent_object id="oval:com.modulo.IIS7:obj:44110" version="1">
            //    <path datatype="string" var_ref="oval:com.modulo.IIS7:var:5161"/>
            //    <filename>applicationHost.config</filename>
            //    <xpath>.//processModel/@pingingEnabled</xpath>
            //</xmlfilecontent_object>

            var mockedXPathOperator = this.CreateMockedXPathOperator(CreateFakeXmlLines(), null);
            var systemDataSource = new XmlFileContentObjectCollector() { XPathOperator = mockedXPathOperator };
            
            var collectedItems = systemDataSource.CollectDataForSystemItem(CreateFakeXmlFileContentItem()).ToArray();

            DoBasicAssertForXmlFileContentCollectedItems(collectedItems, StatusEnumeration.exists);
            var valueOfEntity = ((xmlfilecontent_item)collectedItems.Single().ItemType).value_of;
            Assert.AreEqual(1, valueOfEntity.Count(), "Unexpected value_of entity count was found.");
            ItemTypeEntityChecker.AssertItemTypeEntity(valueOfEntity.Single(), "The OVAL Repository");
        }
Beispiel #2
0
        protected override void ConfigureObjectCollector()
        {
            if (base.ObjectCollector == null)
            {
                var newXPathOperator = new XPathOperator()
                {
                    FileContentProvider = CustomFileProvider
                };
                var objCollector = new XmlFileContentObjectCollector()
                {
                    XPathOperator = newXPathOperator, Platform = this.Platform
                };

                base.ObjectCollector = objCollector;
            }

            if (base.ItemTypeGenerator == null)
            {
                var pathOperatorEvaluator = new PathOperatorEvaluator(CustomFileProvider, Platform);
                var itemTypeGenerator     = new XmlFileContentItemTypeGenerator(pathOperatorEvaluator);

                base.ItemTypeGenerator = itemTypeGenerator;
            }
        }
        public void Should_be_possible_to_handle_XPathNoResultException()
        {
            var mockedPathOperator = this.CreateMockedXPathOperator(null, new XPathNoResultException());
            var systemDataSource = new XmlFileContentObjectCollector() { XPathOperator = mockedPathOperator };

            var collectedItems = systemDataSource.CollectDataForSystemItem(CreateFakeXmlFileContentItem()).ToArray();

            DoBasicAssertForXmlFileContentCollectedItems(collectedItems, StatusEnumeration.doesnotexist);
        }