Beispiel #1
0
        public void TestLongestAnagrams()
        {
            AnagramFinder anagramFinder = new AnagramFinder(words);
            string        expected      = "stressed, desserts";
            string        actual        = anagramFinder.GetLongestAnagrams();

            Assert.Equal(expected, actual);
        }
Beispiel #2
0
        public static void Show(Dictionary <String, String> valuePairs)
        {
            string val = null;

            using (StreamWriter writer = new StreamWriter(outputFile))
            {
                foreach (var key in valuePairs.Keys)
                {
                    if (valuePairs.TryGetValue(key, out val))
                    {
                        if (val.Contains(','))
                        {
                            greaterSet = val.Split(",").ToList().LongCount() > greaterSet.LongCount()
                            ? val.Split(",").ToList() : greaterSet;
                            writer.WriteLine(val);
                        }
                    }
                }
                writer.WriteLine("Largest set: {0}", greaterSet.Aggregate((x, y) => x + " " + y));
                writer.WriteLine("Longest anagrams: {0}", anagramFinder.GetLongestAnagrams());
            }
        }