Exemplo n.º 1
0
        public void Test_LingoGenerator()
        {
            LingoGenerator lg             = new LingoGenerator();
            string         expectedResult = "LingoBingoGenerator.LingoGenerator";

            Assert.AreEqual(expectedResult, lg.GetType().FullName.ToString());
        }
Exemplo n.º 2
0
        public void Test_RandomizeList_EmptyFails()
        {
            LingoGenerator lg           = new LingoGenerator();
            bool           actualResult = lg.RandomizeList();

            Assert.IsFalse(actualResult);
        }
Exemplo n.º 3
0
        public void Test_GetRandomizedList()
        {
            LingoGenerator lg = new LingoGenerator();

            lg.SetLingoWords(ArrayWords26);
            lg.RandomizeList();
            List <string> randomizedList    = lg.GetRandomList();
            List <string> originalList      = ArrayWords26.ToList <string>();
            int           countOfNonMatches = 0;
            int           countOfMatches    = 0;

            for (int index = 0; index <= originalList.Count - 1; index++)
            {
                if (randomizedList[index].ToUpper() != originalList[index].ToUpper())
                {
                    countOfNonMatches++;
                }
                else
                {
                    countOfMatches++;
                }
            }
            double expectedResult = 0.99;
            double actualResult   = countOfMatches / countOfNonMatches;

            Assert.IsTrue(expectedResult >= actualResult);
        }
Exemplo n.º 4
0
        public void Test_LingoWords_Null()
        {
            LingoGenerator lg             = new LingoGenerator();
            List <string>  actualResult   = lg.GetLingoWords();
            List <string>  expectedResult = null;

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemplo n.º 5
0
        public void Test_Count_Null()
        {
            LingoGenerator lg             = new LingoGenerator();
            int            expectedResult = 0;
            int            actualResult   = lg.Count;

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemplo n.º 6
0
        public void Test_GetLongestWordLen()
        {
            LingoGenerator lg = new LingoGenerator();

            lg.SetLingoWords(ArrayWords26);
            int actualResult   = lg.GetLongestWordLen();
            int expectedResult = 8;

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemplo n.º 7
0
        public void Test_GetLongestWordNovember()
        {
            LingoGenerator lg = new LingoGenerator();

            lg.SetLingoWords(ArrayWords26);
            string actualResult   = lg.GetLongestWord();
            string expectedResult = "November";

            Assert.AreEqual(expectedResult.ToUpper(), actualResult.ToUpper());
        }
Exemplo n.º 8
0
        public void Test_LingoWords_Valid()
        {
            LingoGenerator lg = new LingoGenerator();

            lg.SetLingoWords(ArrayWords26);
            int actualResult   = lg.GetLingoWords().Count;
            int expectedResult = 26;

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemplo n.º 9
0
        public void Test_Count_Valid()
        {
            LingoGenerator lg = new LingoGenerator();

            lg.SetLingoWords(ArrayWords26);
            int expectedResult = ArrayWords26.Length;
            int actualResult   = lg.Count;

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemplo n.º 10
0
        static void DrawBoard(List <string> listWords)
        {
            LingoGenerator Words       = new LingoGenerator();
            List <string>  randomWords = null;

            Words.SetLingoWords(listWords);
            if (Words.RandomizeList())
            {
                randomWords = Words.GetRandomList();
            }
            LingoGenerator RandWords = new LingoGenerator();

            RandWords.SetLingoWords(randomWords);
            StringBuilder thisBoard = BingoBoardGeneratorHelper.GenerateBoard(RandWords);

            Console.WriteLine(thisBoard.ToString());
        }