Пример #1
0
 public void GetAll_NoneInIndex_Returns0()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'/>"))
     {
         var index = new IndexOfRefsOfQuestionAnnotations();
         r.AddObserver(index, _progress);
         Assert.AreEqual(0, index.GetAll().Count());
     }
 }
Пример #2
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());
     }
 }
Пример #3
0
 public void GetAll_NoneInIndex_Returns0()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'/>"))
     {
         var index = new IndexOfRefsOfQuestionAnnotations();
         r.AddObserver(index, _progress);
         Assert.AreEqual(0, index.GetAll().Count());
     }
 }
Пример #4
0
 public void GetAll_0OutOf1MatchFilter_Returns0()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
     <annotation class='note' ref='file://black'/>
     </notes>"))
     {
         var index = new IndexOfRefsOfQuestionAnnotations();
         r.AddObserver(index, _progress);
         Assert.AreEqual(0, index.GetAll().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 GetAll_0OutOf1MatchFilter_Returns0()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
<annotation class='note' ref='file://black'/>
</notes>"))
            {
                var index = new IndexOfRefsOfQuestionAnnotations();
                r.AddObserver(index, _progress);
                Assert.AreEqual(0, index.GetAll().Count());
            }
        }
Пример #7
0
 public void GetMatchesOfKey_Has0Matches_ReturnsNone()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
     <annotation class='question' ref='file://red'/>
     <annotation class='note' ref='file://black'/>
     </notes>"))
     {
         var index = new IndexOfRefsOfQuestionAnnotations();
         r.AddObserver(index, _progress);
         Assert.AreEqual(0, index.GetMatchesByKey("blue").Count());
     }
 }
Пример #8
0
        public void GetMatchesOfKey_Has0Matches_ReturnsNone()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'>
<annotation class='question' ref='file://red'/>
<annotation class='note' ref='file://black'/>
</notes>"))
            {
                var index = new IndexOfRefsOfQuestionAnnotations();
                r.AddObserver(index, _progress);
                Assert.AreEqual(0, index.GetMatchesByKey("blue").Count());
            }
        }
Пример #9
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());
            }
        }
Пример #10
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());
     }
 }
Пример #11
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());
     }
 }
Пример #12
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());
     }
 }