コード例 #1
0
        public void ParseApartComplexText_ReturnApartComplexText()
        {
            // Arrange
            const string apartComplexNameXPath = ".//div/div/h2/a";
            var          apartComplexNode      = HtmlNode.CreateNode(_htmlApartComplexLiteral);
            const string expectedResult        = "ЖК Manhattan";

            var htmlParserMock = new Mock <HtmlParser>(new HtmlWeb());

            htmlParserMock
            .Setup(htmlParser => htmlParser.ParseTextByXPath(apartComplexNode, apartComplexNameXPath))
            .Returns(expectedResult);

            var pageHandler = new PageHandler(htmlParserMock.Object);

            // Act
            var actualResult = pageHandler.ParseApartComplexText(apartComplexNode);

            // Assert
            Assert.Equal(expectedResult, actualResult);
        }