public void HandlesNullList()
        {
            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(null);

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(anagramList.Count, 0);
        }
        public void HandlesEmptyList()
        {
            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(new List <string>());

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(anagramList.Count, 0);
        }
        public void FindOneAnagram()
        {
            var inputList = new List <string> {
                "AB", "BA"
            };
            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(inputList);

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(anagramList.Count, 1);
            Assert.AreEqual(anagramList[0], "AB BA");
        }
        public void HandleFourLetterWordAnagramsWithLowerCase()
        {
            var inputList = new List <string> {
                "ABDHE", "DABeh"
            };
            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(inputList);

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(anagramList.Count, 1);
            Assert.AreEqual(anagramList[0], "ABDHE DABeh");
        }
        public void FindTwoAnagramsInNonSequentialOrderAndOneThreeLetterInput()
        {
            var inputList = new List <string> {
                "AB", "CD", "BA", "DC", "DCa"
            };
            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(inputList);

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(anagramList.Count, 2);
            Assert.AreEqual(anagramList[0], "AB BA");
            Assert.AreEqual(anagramList[1], "CD DC");
        }
        public void HandleFourLetterWordInput()
        {
            var inputList = new List <string> {
                "ABC", "DEF", "ABD", "BA", "FED", "AB", "ABDHE"
            };
            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(inputList);

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(anagramList.Count, 2);
            Assert.AreEqual(anagramList[0], "DEF FED");
            Assert.AreEqual(anagramList[1], "BA AB");
        }
        public void FindMultipleMatchesWithDifferentLengths()
        {
            var inputList = new List <string> {
                "ABC", "DEF", "ABD", "BA", "FED", "AB"
            };
            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(inputList);

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(anagramList.Count, 2);
            Assert.AreEqual(anagramList[0], "DEF FED");
            Assert.AreEqual(anagramList[1], "BA AB");
        }
        public void HandleHugeList()
        {
            var inputList     = new List <string>();
            var inputListFile = new System.IO.FileStream("C:\\Git\\codedojo\\Anagrams\\Anagrams\\Anagrams.UnitTests\\data\\wordlist.txt", FileMode.Open);
            var textReader    = new System.IO.StreamReader(inputListFile);

            while (!textReader.EndOfStream)
            {
                inputList.Add(textReader.ReadLine());
            }
            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(inputList);

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(30404, anagramList.Count);
        }
        public void HandleMultipleAnagramsMatching()
        {
            var inputList = new List <string>
            {
                "kinship",
                "pinkish",
                "enlist",
                "inlets",
                "listen",
                "silent",
                "random",
                "not",
                "matched"
            };

            var anagramGenerator = new AnagramGenerator();

            var anagramList = anagramGenerator.GetAnagrams(inputList);

            Assert.IsNotNull(anagramList);
            Assert.AreEqual(2, anagramList.Count);
            Assert.AreEqual("kinship pinkish", anagramList[0]);
            Assert.AreEqual("enlist inlets listen silent", anagramList[1]);
        }