private List <IWebsiteBlockerCheck> CreateChecks(WebsiteBlockerRequestDto requestDto)
        {
            var checks = new List <IWebsiteBlockerCheck>();

            checks.Add(new BlacklistedSiteCheck(requestDto.BlacklistedSites));
            checks.Add(new HtmlCheck(requestDto.BlacklistedWords));
            checks.Add(new WhitelistedSiteCheck(requestDto.WhitelistedSites));
            return(checks);
        }
Beispiel #2
0
        public bool ShouldWebsiteBeBlocked(WebsiteBlockerRequestDto request)
        {
            if (request.Url == null)
            {
                throw new ArgumentNullException();
            }

            var checks = WebsiteBlockerCheckFactory.CreateWebsiteBlockerChecks(request.BlacklistedSites, request.WhitelistedSites, request.BlacklistedWords);

            return(WebsiteBlockerService.ShouldWebsiteBeBlocked(request.Url, checks.ToArray()));
        }