예제 #1
0
 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));
 }
예제 #2
0
 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);
 }
예제 #3
0
        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);
        }
예제 #4
0
        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());
        }
예제 #5
0
        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);
        }
예제 #6
0
 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));
 }
예제 #7
0
 public void SingleUnsupportedMatchTypeThrowsException()
 {
     string line = "title-test:notvalid=title1";
     TagRulesLoader trl = new TagRulesLoader();
     TagRule tagRule = trl.LoadInstruction(line);
 }
예제 #8
0
 public void SingleLineInvalidFormatThrowsException()
 {
     TagRulesLoader trl = new TagRulesLoader();
     TagRule tagRule = trl.LoadInstruction("thiswillfail");
 }
예제 #9
0
 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);
 }