public void Process_ReturnResultOfFirstMatchedStrategy_ResultMatchFirstStrategy()
        {
            // Arrange
            var contentOfFirstNode     = "First_Strategy";
            var mockHttpMessageHandler = new MockHttpMessageHandler();

            mockHttpMessageHandler
            .When(HttpMethod.Get, URL_TEST).Respond("text/html", "Some Respond");

            var mockParseStrategiesProvider = new Mock <IParseStrategiesProvider <IParseStrategy> >();

            mockParseStrategiesProvider.Setup(m => m.Strategies).Returns(new List <IParseStrategy>
            {
                CreateMockIParseStrategy(returnNode: HtmlNode.CreateNode($"<div>{contentOfFirstNode}</div>")).Object,
                CreateMockIParseStrategy(returnNode: HtmlNode.CreateNode("<div>Second_Strategy</div>")).Object
            });
            var strategiesProcessor = new StrategiesProcessorBase <IParseStrategy>(mockParseStrategiesProvider.Object, mockHttpMessageHandler.ToHttpClient());
            // Act
            var result    = strategiesProcessor.Process(URL_TEST);
            var innerText = result.InnerText;

            // Assert
            output.WriteLine($"Content of HtmlNode: {result?.InnerText ?? "NULL"}");
            Assert.Equal(innerText, contentOfFirstNode);
        }
        public void Process_UrlIsValid_ResultNotNull()
        {
            // Arrange
            var mockHttpMessageHandler = new MockHttpMessageHandler();

            mockHttpMessageHandler
            .When(HttpMethod.Get, URL_TEST).Respond("text/html", "Some Respond");

            var mockParseStrategiesProvider = new Mock <IParseStrategiesProvider <IParseStrategy> >();

            mockParseStrategiesProvider.Setup(m => m.Strategies).Returns(new List <IParseStrategy>
            {
                CreateMockIParseStrategy(returnNode: (HtmlNode)null, isUrlValid: true).Object,
            });
            // Act
            var strategiesProcessor = new StrategiesProcessorBase <IParseStrategy>(mockParseStrategiesProvider.Object, mockHttpMessageHandler.ToHttpClient());
            var result = strategiesProcessor.Process(URL_TEST, urlValidation: true);

            // Assert
            output.WriteLine($"Name of HtmlNode: {result?.Name ?? "NULL"}");
            Assert.Null(result);
        }
        public void Process_SecondStrategyMatch_ResultNotNull()
        {
            // Arrange
            var mockHttpMessageHandler = new MockHttpMessageHandler();

            mockHttpMessageHandler
            .When(HttpMethod.Get, URL_TEST).Respond("text/html", "Some Respond");

            var mockParseStrategiesProvider = new Mock <IParseStrategiesProvider <IParseStrategy> >();

            mockParseStrategiesProvider.Setup(m => m.Strategies).Returns(new List <IParseStrategy>
            {
                CreateMockIParseStrategy(returnNode: (HtmlNode)null).Object,
                CreateMockIParseStrategy(returnNode: HtmlNode.CreateNode("<div></div>")).Object  //Does need to be real node otherwise it will return null
            });
            var strategiesProcessor = new StrategiesProcessorBase <IParseStrategy>(mockParseStrategiesProvider.Object, mockHttpMessageHandler.ToHttpClient());
            // Act
            var result = strategiesProcessor.Process(URL_TEST);

            // Assert
            output.WriteLine($"Name of HtmlNode: {result?.Name ?? "NULL"}");
            Assert.NotNull(result);
        }