Example #1
0
        private static void WriteInColorStyled<T>(string trailer, T target, StyleSheet styleSheet)
        {
            TextAnnotator annotator = new TextAnnotator(styleSheet);
            List<KeyValuePair<string, Color>> annotationMap = annotator.GetAnnotationMap(target.AsString());

            MapToScreen(annotationMap, trailer);
        }
        private static void WriteInColorStyled<T, U>(string trailer, T target0, U target1, U target2, U target3, StyleSheet styleSheet)
        {
            TextAnnotator annotator = new TextAnnotator(styleSheet);

            string formatted = string.Format(target0.ToString(), target1, target2, target3);
            List<KeyValuePair<string, Color>> annotationMap = annotator.GetAnnotationMap(formatted);

            MapToScreen(annotationMap, trailer);
        }
        private static void WriteAsciiInColorStyled(string trailer, StyledString target, StyleSheet styleSheet)
        {
            TextAnnotator annotator = new TextAnnotator(styleSheet);
            List<KeyValuePair<string, Color>> annotationMap = annotator.GetAnnotationMap(target.AbstractValue); // Should eventually be target.AsStyledString() everywhere...?

            PopulateColorGeometry(annotationMap, target);

            MapToScreen(target, trailer);
        }
        public void GetAnnotationMap_ReturnsThreeMatches_WhenInputAndPatternOverlap()
        {
            StyleSheet styleSheet = GetDummyStyleSheet();
            TextAnnotator annotator = new TextAnnotator(styleSheet);

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

            Assert.Equal(annotationMap.Count, 3);
        }
        public void GetAnnotationMap_ReturnsInput_WhenInputAndPatternAreNonoverlapping()
        {
            StyleSheet styleSheet = GetDummyStyleSheet();
            TextAnnotator annotator = new TextAnnotator(styleSheet);

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

            Assert.Equal(annotationMap.Single().Key, dummyNonMatchingString);
        }
        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.Equal(mapConcatenated, dummyMatchingString);
        }