Ejemplo n.º 1
0
        public void GetAll_ReturnsEmptyList_AnagramList()
        {
            List <Anagram> newList = new List <Anagram> {
            };
            List <Anagram> result  = Anagram.GetAll();

            CollectionAssert.AreEqual(newList, result);
        }
Ejemplo n.º 2
0
        public void GetWord_GetWord_String()
        {
            string  word       = "Bread";
            Anagram newAnagram = new Anagram(word);
            string  result     = newAnagram.GetWord();

            Assert.AreEqual(word, result);
        }
Ejemplo n.º 3
0
        public void GetUserListToTest_ReturnsListInputted_List()
        {
            List <string> tempList = new List <string> {
                "beer", "beard"
            };
            Anagram newAnagram = new Anagram("bread", tempList);

            CollectionAssert.AreEqual(tempList, newAnagram.GetWordList());
        }
Ejemplo n.º 4
0
        public void AnagramConstructor_CreatesInstanceOfAnagram_Anagram()
        {
            List <string> tempList = new List <string> {
                "beer", "beard"
            };
            Anagram newAnagram = new Anagram("Test", tempList);

            Assert.AreEqual(typeof(Anagram), newAnagram.GetType());
        }
Ejemplo n.º 5
0
        public void CheckIfAnagram_WordLengthsDiffer_False()
        {
            string        stringToTest = "beer";
            List <string> tempList     = new List <string> {
                "bread"
            };
            Anagram newAnagram = new Anagram("bread", tempList);

            Assert.AreEqual(false, newAnagram.CheckIfAnagram(stringToTest));
        }
Ejemplo n.º 6
0
        public void CheckIfPartialMatch_WordIsPartialMatch_True()
        {
            string        stringToTest = "bread";
            List <string> tempList     = new List <string> {
                "red"
            };
            Anagram newAnagram = new Anagram("bread", tempList);

            Assert.AreEqual(true, newAnagram.CheckIfAnagram(stringToTest));
        }
Ejemplo n.º 7
0
        public void CheckIfAnagram_WordIsNotAnagram_False()
        {
            string        stringToTest = "bread";
            List <string> tempList     = new List <string> {
                "beers"
            };
            Anagram newAnagram = new Anagram("beers", tempList);

            Assert.AreEqual(false, newAnagram.CheckIfAnagram(stringToTest));
        }
Ejemplo n.º 8
0
        public void CheckIfAnagram_WordIsAnagram_True()
        {
            string        stringToTest = "bread";
            List <string> tempList     = new List <string> {
                "beard"
            };
            Anagram newAnagram = new Anagram("beard", tempList);

            Assert.AreEqual(true, newAnagram.CheckIfAnagram(stringToTest));
        }
Ejemplo n.º 9
0
        public void SetWord_WordPropertyIsUpdated_String()
        {
            List <string> listToCheck = new List <string> {
                "beers", "beard"
            };
            Anagram newAnagram = new Anagram("stringOne", listToCheck);

            newAnagram.SetWord("stringTwo");
            Assert.AreEqual("stringTwo", newAnagram.GetWord());
        }
Ejemplo n.º 10
0
        public void SetWord_SetWord_String()
        {
            string  word        = "Bread";
            Anagram newAnagram  = new Anagram(word);
            string  updatedWord = "Beard";

            newAnagram.SetWord(updatedWord);
            string result = newAnagram.GetWord();

            Assert.AreEqual(updatedWord, result);
        }
Ejemplo n.º 11
0
        public void GetUserWord_ReturnsWordInputted_String()
        {
            string        word     = "bread";
            List <string> tempList = new List <string> {
                "beer", "beard"
            };
            Anagram newAnagram = new Anagram(word, tempList);
            string  result     = newAnagram.GetWord();

            Assert.AreEqual(word, result);
        }
Ejemplo n.º 12
0
        public void SortArray_CharArray_IsSorted()
        {
            char[]        test     = { 'a', 'b', 'd', 'e', 'r' };
            char[]        testSort = { 'r', 'a', 'e', 'd', 'b' };
            List <string> tempList = new List <string> {
                "bread"
            };
            Anagram newAnagram = new Anagram("bread", tempList);

            CollectionAssert.AreEqual(test, newAnagram.SortArray(testSort));
        }
Ejemplo n.º 13
0
        public void AnagramConstructor_CreatesInstanceOfAnagram_Anagram()
        {
            List <string> listForConstructor = new List <string> {
            };

            listForConstructor.Add("aaaa");
            listForConstructor.Add("bbbb");

            Anagram newAnagram = new Anagram("test", listForConstructor);

            Assert.AreEqual(typeof(Anagram), newAnagram.GetType());
        }
Ejemplo n.º 14
0
        public void ConvertWordToArray_Word_CharArray()
        {
            string stringToTest = "beer";

            char[]        test     = { 'b', 'e', 'e', 'r' };
            List <string> tempList = new List <string> {
                "bread"
            };
            Anagram newAnagram = new Anagram("bread", tempList);

            CollectionAssert.AreEqual(test, newAnagram.ConvertWordToArray(stringToTest));
        }
Ejemplo n.º 15
0
        public void GetAll_ReturnsAnagrams_AnagramList()
        {
            string         word01      = "Bread";
            string         word02      = "Beard";
            Anagram        newAnagram1 = new Anagram(word01);
            Anagram        newAnagram2 = new Anagram(word02);
            List <Anagram> newList     = new List <Anagram> {
                newAnagram1, newAnagram2
            };
            List <Anagram> result = Anagram.GetAll();

            CollectionAssert.AreEqual(newList, result);
        }
Ejemplo n.º 16
0
        public void anagramWordSort_True()
        {
            //Arrange
            string  testWord   = "bread";
            Anagram newAnagram = new Anagram("testWord");

            newAnagram.Save();
            //Act
            string result = newAnagram.anagramWordSort(testWord);

            //Assert
            Assert.AreEqual("abder", result);
        }
Ejemplo n.º 17
0
        public void SetWordList_ListPropertyIsUpdated_List()
        {
            List <string> tempList = new List <string> {
                "beers", "beard"
            };
            List <string> listToSet = new List <string> {
                "bob"
            };
            Anagram newAnagram = new Anagram("stringOne", tempList);

            newAnagram.SetWordList(listToSet);
            Assert.AreEqual(listToSet, newAnagram.GetWordList());
        }
Ejemplo n.º 18
0
        public void AnagramConstructor_ScramblesLettersOfWord_List()
        {
            List <string> listForConstructor = new List <string> {
                "tab", "book", "abt"
            };
            List <string> resultList = new List <string> {
                "tab", "abt"
            };


            Anagram newAnagram = new Anagram("bat", listForConstructor);

            newAnagram.CreateAnagrams();
            CollectionAssert.AreEqual(resultList, newAnagram.Get_anagrams());
        }
Ejemplo n.º 19
0
        public void CheckWordList_WordListContainsAnagram_ListOfAnagrams()
        {
            List <string> expectedResultList = new List <string> {
                "beard"
            };
            List <string> listToCheck = new List <string> {
                "beers", "beard"
            };
            Anagram newAnagram = new Anagram("bread", listToCheck);

            foreach (string word in listToCheck)
            {
                Console.WriteLine(word);
            }
            CollectionAssert.AreEqual(expectedResultList, newAnagram.CheckWordList());
        }
Ejemplo n.º 20
0
        public void GetCompareWord_True()
        {
            //Arrange
            string  testWord   = "bread";
            Anagram newAnagram = new Anagram(testWord);

            newAnagram.Save();

            //Act
            List <Anagram> instances = newAnagram.GetList();
            Anagram        savedItem = instances[0];
            string         results   = instances[0].GetCompareWord();

            //Assert
            Assert.AreEqual(testWord, results);
        }
Ejemplo n.º 21
0
        public void WordConstructor_CreatesInstanceOfWord_Word()
        {
            Anagram newAnagram = new Anagram("test");

            Assert.AreEqual(typeof(Anagram), newAnagram.GetType());
        }
Ejemplo n.º 22
0
        public void AnagramConstructor_CreatesInstanceOfAnagram_Anagram()
        {
            Anagram newAnagram = new Anagram("");

            Assert.AreEqual(typeof(Anagram), newAnagram.GetType());
        }
Ejemplo n.º 23
0
        public void AreCharactersGreaterThanEachOther()
        {
            Anagram testAnagram = new Anagram();

            Assert.AreEqual(true, testAnagram.BIsGreaterThanA('a', 'b'));
        }