示例#1
0
        public void InvalidExtractUrlTest()
        {
            _hackerPageMock.Setup(
                x => x.ExtractUrl(null, It.IsAny <int>(), It.IsAny <NewsItem>()))
            .Throws(new Exception());
            _hackerPage = _hackerPageMock.Object;

            var ex = Assert.Throws <Exception>(() =>
                                               _hackerPage.ExtractUrl(null, 1, new NewsItem()),
                                               "Exception was not thrown for empty HtmlNodeCollection.");
        }
示例#2
0
        public void ValidExtractUrlTest()
        {
            _hackerPageMock.Setup(
                x => x.ExtractUrl(It.IsAny <HtmlNodeCollection>(), It.IsAny <int>(), It.IsAny <NewsItem>()))
            .Returns(new NewsItem());
            _hackerPage = _hackerPageMock.Object;

            var newsItem = _hackerPage.ExtractUrl(new HtmlNodeCollection(null), 1, new NewsItem());

            Assert.IsNotNull(newsItem, "An empty NewsItem has been returned.");
        }