Exemple #1
0
        public void Test_GetWordsAndCategories()
        {
            bool pass = false;
            List <ValueTuple <string, string> > wordsAndCategories = FileManagementHelper.GetWordsAndCategories();
            List <string> words      = new List <string>();
            List <string> categories = new List <string>();

            foreach (ValueTuple <string, string> vtwc in wordsAndCategories)
            {
                words.Add(vtwc.Item2);
                categories.Add(vtwc.Item1);
            }

            List <string> distinctWords     = new List <string>(words.Distinct());
            List <string> distictCategories = new List <string>(categories.Distinct());

            if (distinctWords.Count > 1 && distictCategories.Count > 0)
            {
                if (distinctWords.Count == words.Count)
                {
                    if (distictCategories.Count == 1)
                    {
                        pass = true;
                    }
                }
                DisplayGetWordsAndCategoriesResults(words, distinctWords, distictCategories);
            }
            Assert.AreEqual(true, pass);
        }
Exemple #2
0
        public void Test_GetWordsAndCategories_BadFilenameReturnsErrorCategory()
        {
            List <ValueTuple <string, string> > wordsAndCategories = FileManagementHelper.GetWordsAndCategories("nonExistingFile.xml");

            foreach (ValueTuple <string, string> vtwc in wordsAndCategories)
            {
                Assert.IsTrue(vtwc.Item1.ToString().ToUpper() == "error".ToUpper());
            }
        }
Exemple #3
0
        public void Test_GetWordsAndCategories_EmptyReturnsBlank()
        {
            List <ValueTuple <string, string> > wordsAndCategories = FileManagementHelper.GetWordsAndCategories("emptyLingoWords.xml");

            foreach (ValueTuple <string, string> vtwc in wordsAndCategories)
            {
                Assert.AreEqual(string.IsNullOrEmpty(vtwc.Item1), string.IsNullOrEmpty(vtwc.Item2));
            }
        }