Esempio n. 1
0
        public void Given_A_Valid_Url_And_ITargetBlock_Should_Execute_CardsByUrl()
        {
            // Arrange
            var url = "https://www.google.co.uk/";

            _semanticSearch.CardsByUrl(Arg.Any <string>()).Returns(new List <SemanticCard>());

            // Act
            _sut.Producer(url, new BufferBlock <SemanticCard[]>());

            // Assert
            _semanticSearch.Received(1).CardsByUrl(Arg.Any <string>());
        }
        public void Given_A_CardTipSection_And_TipRelatedCardListTableWith_Should_Invoke_CardsByUrl(string url)
        {
            // Arrange
            var fixture = new Fixture {
                RepeatCount = 10
            };

            _semanticSearch.CardsByUrl(Arg.Any <string>()).Returns(fixture.Create <List <SemanticCard> >());
            var htmlDocument   = new HtmlWeb().Load(url);
            var htmlTable      = new TipRelatedHtmlDocument(_config).GetTable(htmlDocument);
            var cardTipSection = new CardTipSection();

            // Act
            _sut.GetTipRelatedCards(cardTipSection, url, htmlTable);

            // Assert
            _semanticSearch.Received(1).CardsByUrl(Arg.Any <string>());
        }