コード例 #1
0
        public void GetAnnotationMap_ReturnsInput_WhenInputAndPatternAreNonoverlapping()
        {
            StyleSheet    styleSheet = GetDummyStyleSheet();
            TextAnnotator annotator  = new TextAnnotator(styleSheet);

            List <KeyValuePair <string, Color> > annotationMap = annotator.GetAnnotationMap(dummyNonMatchingString);

            Assert.AreEqual(annotationMap.Single().Key, dummyNonMatchingString);
        }
コード例 #2
0
        public void GetAnnotationMap_ReturnsThreeMatches_WhenInputAndPatternOverlap()
        {
            StyleSheet    styleSheet = GetDummyStyleSheet();
            TextAnnotator annotator  = new TextAnnotator(styleSheet);

            List <KeyValuePair <string, Color> > annotationMap = annotator.GetAnnotationMap(dummyMatchingString);

            Assert.AreEqual(annotationMap.Count, 3);
        }
コード例 #3
0
        public void GetAnnotationMap_ReturnsPermutationOfInput()
        {
            StyleSheet    styleSheet = GetDummyStyleSheet();
            TextAnnotator annotator  = new TextAnnotator(styleSheet);

            List <KeyValuePair <string, Color> > annotationMap = annotator.GetAnnotationMap(dummyMatchingString);
            string mapConcatenated = String.Join("", annotationMap.Select(element => element.Key));

            Assert.AreEqual(mapConcatenated, dummyMatchingString);
        }
コード例 #4
0
        public void GetAnnotationMap_CoversOverlappingMatchesWithLeftmostOnTop_WhenMatchedBlocksOverlap()
        {
            StyleSheet    styleSheet = GetDummyOverlappingStyleSheet();
            TextAnnotator annotator  = new TextAnnotator(styleSheet);

            List <KeyValuePair <string, Color> > annotationMap = annotator.GetAnnotationMap(dummyMatchingString);

            Assert.Equal(2, annotationMap.Count);
            Assert.Equal(new KeyValuePair <string, Color>("ca", Color.Yellow), annotationMap[0]);
            Assert.Equal(new KeyValuePair <string, Color>("t", Color.Green), annotationMap[1]);
        }