Esempio n. 1
0
        private IEnumerable <KeyValuePair <string, string> > Process(SorterType type)
        {
            var results = WithSorter(type, _text).Sort();
            var pairs   = new List <KeyValuePair <string, string> >();

            foreach (var result in results)
            {
                pairs.Add(new KeyValuePair <string, string>(result, type.ToString()));
            }

            return(pairs);
        }
Esempio n. 2
0
        private ISorter WithSorter(SorterType sortertype, string[] text)
        {
            var sorter = _sorters.SingleOrDefault(q => q.GetType().GetAttributeType().Equals(sortertype));

            if (sorter == null)
            {
                throw new UnknownSorterException(sortertype.ToString());
            }

            sorter.Text = text.CleanText();

            return(sorter);
        }