コード例 #1
0
        public ActionResult Results()
        {
            Anagramer     newWord = new Anagramer(Request.Form["inputWord"]);
            List <string> result  = newWord.GetValue(newWord.GetWord());

            return(View(result));
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var fileName = @"C:\Users\l.dutrillaux\Documents\Kata\Anagrams\wordlist.txt";

            var anagrammer = new Anagramer();

            anagrammer.PrintAnagrams(fileName);
        }
コード例 #3
0
        public void GetValue2()
        {
            //Arrange
            Anagramer newWord = new Anagramer("alert");

            var output = new List <string> {
                "alert", "alter", "later"
            };

            //Act
            List <string> result = newWord.GetValue(newWord.GetWord());

            //Assert
            CollectionAssert.AreEqual(result, output);
        }
コード例 #4
0
        public void GetValue()
        {
            //Arrange
            Anagramer newWord = new Anagramer("beast");

            var output = new List <string> {
                "abets", "baste", "betas", "beast", "beats"
            };

            //Act
            List <string> result = newWord.GetValue(newWord.GetWord());

            //Assert
            CollectionAssert.AreEqual(result, output);
        }
コード例 #5
0
ファイル: ProgramTest.cs プロジェクト: Dutrillaux/Kata
        public void GetAnagramsFromAshortUnsortedList()
        {
            var input = new List <string> {
                "kinship", "pinkish", "toto", "titi", "tata", "atat", "stink", "rots", "sort"
            };
            var anagramer = new Anagramer();

            var rawWords = anagramer.GetWords(input);
            var result   = anagramer.GetAnagrams(rawWords).ToList();

            Assert.IsTrue(result.Count() == 3);
            Assert.IsTrue(result.Contains("kinship pinkish"));
            Assert.IsTrue(result.Contains("tata atat"));
            Assert.IsTrue(result.Contains("rots sort"));
        }