Exemplo n.º 1
0
        public void Should_be_possible_to_handle_filenotfoundexception()
        {
            var mockedPathOperator = this.CreateMockedXPathOperator(null, new FileNotFoundException());
            var systemDataSource   = new XmlFileContentObjectCollector()
            {
                XPathOperator = mockedPathOperator
            };

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

            DoBasicAssertForXmlFileContentCollectedItems(collectedItems, StatusEnumeration.doesnotexist);
        }
Exemplo n.º 2
0
        public void Should_be_possible_to_handle_unexpected_exception()
        {
            var mockedPathOperator = this.CreateMockedXPathOperator(null, new Exception("Test Exception"));
            var systemDataSource   = new XmlFileContentObjectCollector()
            {
                XPathOperator = mockedPathOperator
            };

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

            DoBasicAssertForXmlFileContentCollectedItems(collectedItems, StatusEnumeration.error);
        }
Exemplo n.º 3
0
        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");
        }