public void AddIndex_AddSameIndexTwice_Throws()
 {
     using (var r = AnnotationRepository.FromString("id", @"<notes version='0'/>"))
     {
         var index1 = new IndexOfAllOpenConflicts();
         r.AddObserver(index1, _progress);
         var index2 = new IndexOfAllOpenConflicts();
       Assert.Throws<ApplicationException>(() => r.AddObserver(index2, _progress));
     }
 }
Ejemplo n.º 2
0
        public void GetMatches_AddedBeforeIndexInitialization_FoundViaPredicate()
        {
            using (var r = AnnotationRepository.FromString("id", @"<notes version='0'></notes>"))
            {
                var ann = new Annotation("conflict", "blah://blah?rid=12345", "somepath");
                ann.AddMessage("merger", "open", string.Empty);
                r.AddAnnotation(ann);

                var index = new IndexOfAllOpenConflicts();
                r.AddObserver(index, _progress);
                Assert.AreEqual(1, index.GetMatches(rf => rf.Contains("rid=12345"), _progress).Count());
                Assert.AreEqual(0, index.GetMatches(rf => rf.Contains("rid=333"), _progress).Count());
                ann.SetStatusToClosed("testman");
                Assert.AreEqual(0, index.GetMatches(rf => rf.Contains("rid=12345"), _progress).Count());
            }
        }