コード例 #1
0
        public void GetMatchesByKey_HasAnnotationWithoutRef_DoesntCrash()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'></notes>"))
            {
                r.AddAnnotation(new Annotation("question", "lift://blah.lift", "somepath"));

                var index = new SubClassForTest("id");
                r.AddObserver(index, _progress);
                Assert.AreEqual(0, index.GetMatchesByKey("222").Count());
            }
        }
コード例 #2
0
        public void GetMatchesByKey_HasAnnotationWithoutRef_DoesntCrash()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'></notes>"))
            {
                r.AddAnnotation(new Annotation("question", "lift://blah.lift", "somepath"));

                var index = new SubClassForTest("id");
                r.AddObserver(index, _progress);
                Assert.AreEqual(0, index.GetMatchesByKey("222").Count());
            }
        }
コード例 #3
0
        public void Remove_IndexAddedAfterRepoConstruction_RemovesIt()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
<annotation class='note' ref='blah://blah?id=blue'/>
</notes>"))
            {
                var index = new SubClassForTest("id");
                r.AddObserver(index, _progress);
                var blues = index.GetMatchesByKey("blue");
                r.Remove(blues.First());
                blues = index.GetMatchesByKey("blue");
                Assert.AreEqual(0, blues.Count(), "should be none left");
            }
        }
コード例 #4
0
 public void Remove_2AnnotationsWithSameTarget_OnlyRemoves1FromIndex()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
     <annotation class='question' ref='blah://blah?id=blue'/>
     <annotation class='note' ref='blah://blah?id=blue'/>
     </notes>"))
     {
         var index = new SubClassForTest("id");
         r.AddObserver(index, _progress);
         var blues = index.GetMatchesByKey("blue");
         r.Remove(blues.First());
         blues = index.GetMatchesByKey("blue");
         Assert.AreEqual(1, blues.Count(), "should be one left");
     }
 }
コード例 #5
0
        public void Remove_2AnnotationsWithSameTarget_OnlyRemoves1FromIndex()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
<annotation class='question' ref='blah://blah?id=blue'/>
<annotation class='note' ref='blah://blah?id=blue'/>
</notes>"))
            {
                var index = new SubClassForTest("id");
                r.AddObserver(index, _progress);
                var blues = index.GetMatchesByKey("blue");
                r.Remove(blues.First());
                blues = index.GetMatchesByKey("blue");
                Assert.AreEqual(1, blues.Count(), "should be one left");
            }
        }
コード例 #6
0
 public void Remove_IndexAddedAfterRepoConstruction_RemovesIt()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
     <annotation class='note' ref='blah://blah?id=blue'/>
     </notes>"))
     {
         var index = new SubClassForTest("id");
         r.AddObserver(index, _progress);
         var blues = index.GetMatchesByKey("blue");
         r.Remove(blues.First());
         blues = index.GetMatchesByKey("blue");
         Assert.AreEqual(0, blues.Count(), "should be none left");
     }
 }