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

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

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

            CollectionAssert.AreEqual(tempList, newAnagram.GetWordList());
        }
        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());
        }
        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));
        }
        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));
        }
        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));
        }
        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));
        }
        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());
        }
Beispiel #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);
        }
        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);
        }
        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));
        }
Beispiel #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());
        }
        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));
        }
Beispiel #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);
        }
Beispiel #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);
        }
        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());
        }
Beispiel #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());
        }
        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());
        }
Beispiel #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);
        }
Beispiel #21
0
        public void WordConstructor_CreatesInstanceOfWord_Word()
        {
            Anagram newAnagram = new Anagram("test");

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

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

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