Example #1
0
        static void Main(string[] args)
        {
            System.Console.Write("Enter input file: ");
            string filename = Console.ReadLine();

            System.Console.WriteLine();

            System.Console.Write("Enter output file: ");
            outputFile = Console.ReadLine();

            anagramFinder = new AnagramFinder(filename);
            Show(anagramFinder.GetAnagramGroups());
        }
Example #2
0
        public void TestAnagram()
        {
            Dictionary <string, string> expected = new Dictionary <string, string>();

            expected.Add("art", "tar, rat");
            expected.Add("acr", "arc, car");
            expected.Add("aegln", "glean, angel");
            expected.Add("deerssst", "stressed, desserts");
            expected.Add("aestt", "state, taste");
            expected.Add("below", "elbow, below");
            expected.Add("cdeir", "cried, cider");
            expected.Add("dstuy", "dusty, study");
            expected.Add("aiprs", "pairs, paris");
            expected.Add("chin", "chin, inch");
            expected.Add("ghint", "night , thing");
            expected.Add("bdeor", "robed, bored");
            expected.Add("abgr", "grab, brag");
            expected.Add("act", "cat, act");
            expected.Add("deenrv", "nerved, denver, vender");
            expected.Add("aesv", "save, vase");
            expected.Add("eostv", "votes, stove");
            expected.Add("defir", "fried, fired");
            expected.Add("deintu", "untied, united");
            expected.Add("dgo", "dog, god");
            expected.Add("flow", "wolf, flow");
            expected.Add("aceehrt", "teacher, cheater");
            expected.Add("abekr", "break, baker");
            expected.Add("bdeilur", "rebuild, builder");
            expected.Add("cdei", "dice, iced");
            expected.Add("aenorst", "senator, treason");
            expected.Add("cehiknt", "kitchen, thicken");

            AnagramFinder anagram = new AnagramFinder(words);
            Dictionary <string, string> actual = anagram.GetAnagramGroups();

            Assert.Equal(expected, actual);
        }