public void isWhitelistedEPTest() { string reason_throwaway = ""; IHTTPFilter filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { new PhraseFilter() { Type = BlockPhraseType.WORDCONTAINING, Phrase = "bad", Scope = BlockPhraseScope.ANY }, new PhraseFilter() { Type = BlockPhraseType.REGEX, Phrase = "wor[dk]", Scope = BlockPhraseScope.ANY } } , AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = false, DomainFormat = "e.com", Type = AllowDomainType.EXACT, AllowEP = new List <EPPolicy>() { new EPPolicy() { Type = AllowEPType.STARTWITH, EpFormat = "/i-am-whitelisted" } } } } }; string ep1 = "/search?q=verybadword"; string ep2 = "/i-am-whitelisted"; string ep3 = "/i-am-whitelisted/badword"; // any ep except bad phrases: areTrue(filter.isWhitelistedEP(new DomainPolicy() { DomainBlocked = false, DomainFormat = "", Type = AllowDomainType.EXACT, AllowEP = new List <EPPolicy>() }, ep1, out reason_throwaway)); areFalse(filter.isContentAllowed(ep1, BlockPhraseScope.URL, out reason_throwaway)); // only ep that are whitelisted var domain1 = ((FilterPolicy)filter).AllowedDomains[0]; areTrue(filter.isWhitelistedEP(domain1, ep2, out reason_throwaway)); areFalse(filter.isWhitelistedEP(domain1, "/not-whitelisted", out reason_throwaway)); areTrue(filter.isWhitelistedEP(domain1, ep2 + "/work", out reason_throwaway)); areFalse(filter.isContentAllowed(ep2 + "/work", BlockPhraseScope.URL, out reason_throwaway)); areFalse(filter.isWhitelistedURL(new Uri("http://e.com" + ep2 + "/work"), out reason_throwaway)); // does both checks areFalse(filter.isContentAllowed(ep3, BlockPhraseScope.URL, out reason_throwaway)); areFalse(filter.isWhitelistedURL(new Uri("http://e.com" + ep3), out reason_throwaway)); // does both checks areFalse(filter.isWhitelistedEP(null, "", out reason_throwaway)); }