Ejemplo n.º 1
0
        public void InvalidExtractRankTest()
        {
            _hackerPageMock.Setup(
                x => x.ExtractRank(null, It.IsAny <int>(), It.IsAny <NewsItem>()))
            .Throws(new Exception());
            _hackerPage = _hackerPageMock.Object;

            var ex = Assert.Throws <Exception>(() =>
                                               _hackerPage.ExtractRank(null, 1, new NewsItem()),
                                               "Exception was not thrown for empty HtmlNodeCollection.");
        }
Ejemplo n.º 2
0
        public void ValidExtractRankTest()
        {
            _hackerPageMock.Setup(
                x => x.ExtractRank(It.IsAny <HtmlNodeCollection>(), It.IsAny <int>(), It.IsAny <NewsItem>()))
            .Returns(new NewsItem());
            _hackerPage = _hackerPageMock.Object;

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

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