Exemple #1
0
        public void GetAnswersByGame_WhenGameIdIsProvided_ShouldReturnAllGamesAnswers()
        {
            var(game, answer)         = CreateGameWithQuestion();
            var(player, pickedAnswer) = AddPlayerToGame(game, answer);
            AddPlayerToGame(game, answer);
            var repository = new SubmitedAnswersRepository(_dbContext);

            var found = repository.GetAnswersByGame(game);

            found.Count().ShouldBe(2);
            found.All(x => x.GameId == game).ShouldBeTrue();
        }
Exemple #2
0
        public void GetAnswersByPlayer_WhenParticipantsIdIsProvided_ShouldReturnPlayersAnswers()
        {
            var(game, answer)         = CreateGameWithQuestion();
            var(player, pickedAnswer) = AddPlayerToGame(game, answer);
            AddPlayerToGame(game, answer);
            var repository = new SubmitedAnswersRepository(_dbContext);

            var found = repository.GetAnswersByPlayer(player);

            found.Count().ShouldBe(1);
            found.First().PickedAnswerId.ShouldBe(answer);
            found.First().PlayerId.ShouldBe(player);
        }