public void SingleTitleMatchTitle() { string line = "title-test:title=title1"; TagRulesLoader trl = new TagRulesLoader(); TagRule tagRule = trl.LoadInstruction(line); var item = new RilListItem { Title = "title1", Url = "test1.com" }; Assert.IsTrue(tagRule.HasMatch(item)); }
public void SingleTitleParsesTitle() { string line = "title-test:title=title1"; TagRulesLoader trl = new TagRulesLoader(); TagRule tagRule = trl.LoadInstruction(line); var item = new RilListItem { Title = "title1", Url = "test1.com" }; Assert.AreEqual(MatchTypes.Title, tagRule.Matches.First().MatchType); }
public void SingleLineParsesTag() { string line = "android-apps:url=test1.com"; TagRulesLoader trl = new TagRulesLoader(); TagRule tagRule = trl.LoadInstruction(line); Assert.AreEqual("android-apps", tagRule.Tag); }
public void MultipleLinesParsesAll() { string[] lines = new string[] { "test-tag1:url=test1.com", "test-tag2:url=test2.com" }; TagRulesLoader trl = new TagRulesLoader(); IEnumerable<TagRule> tagRule = trl.LoadInstruction(lines); Assert.AreEqual(lines.Length, tagRule.Count()); }
public void DuplicateTagsCollapsesToOneTagRuleTwoMatches() { string[] lines = new string[] { "test-tag:url=test1.com", "test-tag:url=test2.com" }; TagRulesLoader trl = new TagRulesLoader(); IEnumerable<TagRule> tagRule = trl.LoadInstruction(lines); Assert.AreEqual(1, tagRule.Count()); Assert.AreEqual(2, tagRule.First().Matches.Count); }
public void SingleUrlMatchesUrl() { string line = "android-apps:url=test1"; TagRulesLoader trl = new TagRulesLoader(); TagRule tagRule = trl.LoadInstruction(line); var item = new RilListItem { Title = "test1", Url = "test1.com" }; Assert.IsTrue(tagRule.HasMatch(item)); }
public void SingleUnsupportedMatchTypeThrowsException() { string line = "title-test:notvalid=title1"; TagRulesLoader trl = new TagRulesLoader(); TagRule tagRule = trl.LoadInstruction(line); }
public void SingleLineInvalidFormatThrowsException() { TagRulesLoader trl = new TagRulesLoader(); TagRule tagRule = trl.LoadInstruction("thiswillfail"); }
public void SingleUrlParsesUrl() { string line = "android-apps:url=test1"; TagRulesLoader trl = new TagRulesLoader(); TagRule tagRule = trl.LoadInstruction(line); var item = new RilListItem { Title = "test1", Url = "test1.com" }; Assert.AreEqual(MatchTypes.URL, tagRule.Matches.First().MatchType); }