Exemplo n.º 1
0
        public void ColorGameQuestionReturnsIsMatchIfLeftWordEqualsRightColorElseReturnsFalse()
        {
            AgileMind.BLL.Games.ColorGameQuestion gameQuestion = new AgileMind.BLL.Games.ColorGameQuestion();

            gameQuestion.LeftWord = "Blue";
            gameQuestion.RightColor = "Blue";

            Assert.IsTrue(gameQuestion.IsMatch);

            gameQuestion.RightColor = "NotBlue";
            Assert.IsFalse(gameQuestion.IsMatch);
        }
Exemplo n.º 2
0
        public void ColorGameQuestionHasPropertiesForLeftWordLeftColorRightWordRightColorIsMatchAndUserCorrect()
        {
            AgileMind.BLL.Games.ColorGameQuestion gameQuestion = new AgileMind.BLL.Games.ColorGameQuestion();
            gameQuestion.LeftColor = "Red";
            Assert.AreEqual("Red", gameQuestion.LeftColor);

            gameQuestion.LeftWord = "Blue";
            Assert.AreEqual("Blue", gameQuestion.LeftWord);

            gameQuestion.RightColor = "Green";
            Assert.AreEqual("Green", gameQuestion.RightColor);

            gameQuestion.RightWord = "Purple";
            Assert.AreEqual("Purple", gameQuestion.RightWord);

            gameQuestion.UserCorrect = true;
            Assert.IsTrue(gameQuestion.UserCorrect);
        }
        public static ColorGameResult CreateGame()
        {
            ColorGameResult result = new ColorGameResult();

            Random rand = new Random();
            for (int questionCount = 0; questionCount < 10; questionCount++)
            {
                ColorGameQuestion newQuestion = new ColorGameQuestion();

                newQuestion.LeftColor = RandomColor(rand);
                newQuestion.LeftWord = RandomColor(rand);
                newQuestion.RightColor = RandomColor(rand);
                newQuestion.RightWord = RandomColor(rand);

                result.Questions.Add(newQuestion);
            }

            result.Success = true;
            return result;
        }