Exemplo n.º 1
0
        public void AcertouPergunta()
        {
            //arrange
            var pergunta = MockListaPergunta().First();
            //action
            var resposta = _service.Acertou(pergunta.PerguntaId, pergunta.OpcaoCerta);

            //assert
            Assert.IsTrue(resposta);
        }
Exemplo n.º 2
0
        public IActionResult Responder(int id, string resposta)
        {
            var per = _perguntaService.getById(id).QuizzId;

            if (!string.IsNullOrEmpty(resposta))
            {
                var estudante = _userManager.FindByNameAsync(User.Identity.Name).Result;
                var aluno     = _alunoService.GetbySession(estudante.Id);
                var pergunta  = _perguntaService.getById(id);
                var pontuacao = _alunoService.Pontuou(pergunta.PerguntaId);
                var acertou   = _alunoService.Acertou(pergunta.PerguntaId, resposta);
                if (acertou)
                {
                    var pontuarAluno = _alunoService.PontuarAluno(estudante.Id, pontuacao);
                    var i            = _respostaService.GerarReposta(aluno.EstudanteId, pergunta.PerguntaId, true, resposta, (int)pontuacao);
                    return(RedirectToAction("IniciarQuizz", "Aluno", new { id = pergunta.QuizzId }));
                }
                else
                {
                    var i = _respostaService.GerarReposta(aluno.EstudanteId, pergunta.PerguntaId, acertou, resposta, (int)pontuacao);
                    return(RedirectToAction("IniciarQuizz", "Aluno", new { id = pergunta.QuizzId }));;
                }
            }
            ;
            return(RedirectToAction("IniciarQuizz", "Aluno", new { id = per }));
        }