Пример #1
0
        public void ParseFeedNodeItemsTest_ServiceName_Success()
        {
            // arrange
            string uriPrefix = string.Empty;

            // setup HTML Model
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(this.htmlFileContents);
            HtmlNode tdnode = doc.CreateElement("td");
            doc.OptionUseIdAttribute = true;
            tdnode.Name = "td";
            tdnode.InnerHtml = RSSFeedResponseResource.ParseFeedNodeItems1;

            // setup Test Object
            HtmlParser target = new HtmlParser(uriPrefix);
            List<HTMLParserFeedItem> actual;

            // act
            actual = target.ParseFeedNodeItems(tdnode);

            // assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(1, actual.Where(item => item.Name == HTMLParserFeedItemType.ServiceName && item.Value == "Access Control 1.0").Count());
        }
Пример #2
0
        public void ParseFeedNodeItemsTest_Fail1()
        {
            // arrange
            string uriPrefix = string.Empty;

            // setup HTML Model
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(this.htmlFileContents);
            HtmlNode tdnode = doc.CreateElement("td");
            doc.OptionUseIdAttribute = true;
            tdnode.Name = "td";
            tdnode.InnerHtml = RSSFeedResponseResource.TestTDFail1;

            // setup Test Object
            HtmlParser target = new HtmlParser(uriPrefix);
            List<HTMLParserFeedItem> actual;

            // act
            actual = target.ParseFeedNodeItems(tdnode);

            // assert
            Assert.IsNull(actual);
        }