Beispiel #1
0
 public async Task Create(JokenpoItem jokenpo)
 {
     using (_context)
     {
         _context.Jokenpos.Add(jokenpo);
         await _context.SaveChangesAsync();
     }
 }
        public void Dado_um_jogo_jokenpo_onde_jogador1_e_jogador2_jogarem_igual_deve_empatar(char p1, char p2)
        {
            JokenpoItem _jokenpo = new JokenpoItem(p1, p2);

            _jokenpo.Play();

            Assert.AreEqual(_jokenpo.PlayerWinner, 0);
        }
        public void Dado_um_jogo_jokenpo_jogador1_deve_ganhar(char p1, char p2)
        {
            JokenpoItem _jokenpo = new JokenpoItem(p1, p2);

            _jokenpo.Play();

            Assert.AreEqual(_jokenpo.PlayerWinner, 1);
        }
        public async Task <string> Handle(PlayJokenpoCommand command)
        {
            var jokenpo = new JokenpoItem((char)command.PlayerOne,
                                          (char)command.PlayerTwo);

            jokenpo.Play();

            await _jokenpoRepository.Create(jokenpo);

            switch (jokenpo.PlayerWinner)
            {
            case 1:
                return("Player one winner");

            case 2:
                return("Player two winner");

            default:
                return("Draw");
            }
        }
        public void Dado_um_novo_jokenpo_o_mesmo_nao_pode_ter_vencedor()
        {
            JokenpoItem _jokenpoValid = new JokenpoItem('R', 'P');

            Assert.AreEqual(_jokenpoValid.PlayerWinner, 0);
        }