コード例 #1
0
 public void GetMatches_Has0Matches_ReturnsNone()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'/>"))
     {
         var index = new IndexOfRefsOfQuestionAnnotations();
         r.AddObserver(index, _progress);
         Assert.AreEqual(0, index.GetMatches(key => key.Contains("b"), _progress).Count());
     }
 }
コード例 #2
0
        public void GetMatches_PredicateGivesNullForOne_ReturnsIt()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
<annotation class='question'/>
</notes>"))
            {
                var index = new IndexOfRefsOfQuestionAnnotations();
                r.AddObserver(index, _progress);
                Assert.AreEqual(1, index.GetMatches(key => string.IsNullOrEmpty(key), _progress).Count());
            }
        }
コード例 #3
0
        public void GetMatches_Has2Matches_Returns2()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
<annotation class='question' ref='file://red'/>
<annotation class='question' ref='file://blue'/>
<annotation class='question' ref='file://blue'/>
<annotation class='note' ref='file://black'/>
</notes>"))
            {
                var index = new IndexOfRefsOfQuestionAnnotations();
                r.AddObserver(index, _progress);
                Assert.AreEqual(2, index.GetMatches(key => key.Contains("b"), _progress).Count());
            }
        }
コード例 #4
0
 public void GetMatches_Has0Matches_ReturnsNone()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'/>"))
     {
         var index = new IndexOfRefsOfQuestionAnnotations();
         r.AddObserver(index, _progress);
         Assert.AreEqual(0, index.GetMatches(key=>key.Contains("b"), _progress).Count());
     }
 }
コード例 #5
0
 public void GetMatches_PredicateGivesNullForOne_ReturnsIt()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
     <annotation class='question'/>
     </notes>"))
     {
         var index = new IndexOfRefsOfQuestionAnnotations();
         r.AddObserver(index, _progress);
         Assert.AreEqual(1, index.GetMatches(key => string.IsNullOrEmpty(key), _progress).Count());
     }
 }
コード例 #6
0
 public void GetMatches_Has2Matches_Returns2()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
     <annotation class='question' ref='file://red'/>
     <annotation class='question' ref='file://blue'/>
     <annotation class='question' ref='file://blue'/>
     <annotation class='note' ref='file://black'/>
     </notes>"))
     {
         var index = new IndexOfRefsOfQuestionAnnotations();
         r.AddObserver(index, _progress);
         Assert.AreEqual(2, index.GetMatches(key => key.Contains("b"), _progress).Count());
     }
 }