Пример #1
0
        public void ArgumentEmptyConstructorTest()
        {
            var answerGenerater = new AnswerGenerator(null);

            Assert.IsNotNull(answerGenerater);
            Assert.Fail();
        }
Пример #2
0
        public ActionResult Index(string NextQuestion)
        {
            var latest = new QuestionAndAnswer
            {
                Question = NextQuestion,
                Answer   = AnswerGenerator.GenerateAnswer(NextQuestion)
            };

            allAnswers.Insert(0, latest);

            return(View(allAnswers));
        }
Пример #3
0
    private void GetNewQuestion()
    {
        TextQuestion textQuestion = randomTextQuestion.GetRandomTextQuestion();

        answer = textQuestion.GetAnswer();
        PlayerPrefs.SetString("Correct Answer", textQuestion.GetNormAnswer());
        AnswerGenerator answerGenerator = new AnswerGenerator(answer);

        questionLabel.text           = textQuestion.GetQuestion();
        blankAnswer                  = answerGenerator.GetUncompleteAnswer();
        answerLabel.text             = blankAnswer;
        indexBlankChar               = answerGenerator.GetIndexBlankChar();
        listCharacterForAnswerButton = choice.GetChoice(answer[indexBlankChar[0]]);
        Debug.Log(answer);
    }
Пример #4
0
        private static Game CreateGame()
        {
            var mockRandom = new Mock <IRandomIntNumber>();

            mockRandom.SetupSequence(r => r.Next())
            .Returns(1)
            .Returns(2)
            .Returns(3)
            .Returns(4);
            var       answerGenerator = new AnswerGenerator(mockRandom.Object);
            const int roundAmount     = 3;

            var game = new Game(roundAmount, answerGenerator);

            return(game);
        }
        public ActionResult Index(string NextQuestion)
        {
            ViewBag.CustomerName = CMConfiguration.CustomerName;
            ViewBag.LogoUrl      = CMConfiguration.LogoUrl;
            ViewBag.DbName       = CMConfiguration.DbName;
            ViewBag.Version      = CMConfiguration.Version;

            var latest = new QuestionAndAnswer
            {
                Question = NextQuestion,
                Answer   = AnswerGenerator.GenerateAnswer(NextQuestion)
            };

            allAnswers.Insert(0, latest);

            return(View(allAnswers));
        }
Пример #6
0
        public void Should_generate_actual_answer()
        {
            // given
            var mockRandom = new Mock <IRandomIntNumber>();

            mockRandom.SetupSequence(r => r.Next())
            .Returns(1)
            .Returns(2)
            .Returns(13)
            .Returns(3)
            .Returns(2)
            .Returns(4);

            var generator = new AnswerGenerator(mockRandom.Object);

            // when
            var answer = generator.Generate();

            // then
            Assert.Equal(new List <int> {
                1, 2, 3, 4
            }, answer.Numbers);
        }
Пример #7
0
 public Game(int roundAmount, AnswerGenerator answerGenerator)
 {
     _roundAmount = roundAmount;
     _round       = new Round(answerGenerator.Generate());
     _gameResult  = new GameResult();
 }