public async Task LoadApartComplexDataHtml() { // Arrange var apartComplexHtmlNode = HtmlNode.CreateNode(_htmlApartComplexLiteral); var loadHtmlNodesTask = Task.Run(() => new HtmlNodeCollection(null) { apartComplexHtmlNode }); var htmlParser = new Mock <HtmlParser>(new HtmlWeb()); htmlParser .Setup(htmlParser => htmlParser.LoadHtmlNodes(_homePageUrl, _apartComplexGroupXPath)) .Returns(loadHtmlNodesTask); var expectedResult = new HtmlNodeCollection(null) { apartComplexHtmlNode }; var pageHandler = new PageHandler(htmlParser.Object); // Act var actualResult = await pageHandler.LoadApartComplexDataHtml(); // Assert Assert.Equal(expectedResult, actualResult); }