This program will use conveyancing software
as keywords to search on google and retrieves the first 100 results. It will then find out which search result contains www.smokeball.com.au
and return the indices of these items.
- Single responsibility
WebRequestSender
to send http requests;SimpleHtmlParser
to parse html as needed;GoogleSearchUrlBuilder
to build google search url;FindSmokeBall
to handle the pattern matching;
- Program to interfaces:
IHtmlParser
andIWebRequestSender
- Dependencies are injected for ease of unit testing
public FindSmokeBall(IWebRequestSender webRequestSender, IHtmlParser htmlParser) { _webRequestSender = webRequestSender; _htmlParser = htmlParser; }
- Example unit testing
FindSmokeBallTest
- Extention method for cleaner logic
StringReaderExtension