コード例 #1
0
            private static GameResp FillGameResp(Game game)
            {
                try
                {
                    if (game != null)
                    {
                        GameResp _gameResp = new GameResp()
                        {
                            GameId       = game.GameId,
                            CreationDate = game.CreationDate,
                            GenreName    = game.GenreName
                        };

                        foreach (var question in game.Questions)
                        {
                            _gameResp.Questions.Add(FillQuestionResp(question));
                        }

                        return(_gameResp);
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
コード例 #2
0
        public async Task AnswerQuestion()
        {
            GameResp _gameResp = await TriviaGameRestEFAPIBLL.GameHelper.CreateGame("Horror");

            foreach (var question in _gameResp.Questions)
            {
                await TriviaGameRestEFAPIBLL.GameHelper.AnswerQuestion(new AnswerQuestionReq()
                {
                    GameId         = _gameResp.GameId,
                    QuestionId     = question.QuestionId,
                    ChoiceId       = question.Choices.Where(choice => choice.IsCorrect).FirstOrDefault().ChoiceId,
                    AnswerDuration = 10
                });
            }

            Assert.IsTrue(true);
        }
コード例 #3
0
        public async Task CreateGame()
        {
            GameResp _gameResp = await TriviaGameRestEFAPIBLL.GameHelper.CreateGame("Action");

            Assert.IsTrue(_gameResp.GenreName == "Action");
        }