Пример #1
0
        public void CrearRonda()
        {
            jugadores.Add(new be.Jugador("Pedro"));
            jugadores.Add(new be.Jugador("Juan"));

            be.Partida partida       = new be.Partida(jugadores);
            bll.Ronda  rondaServices = new bll.Ronda();
            rondaServices.AsignarPartida(partida);
            ronda = rondaServices.CrearRonda();

            Assert.IsInstanceOfType(ronda, typeof(be.Ronda));
        }
Пример #2
0
        public be.Partida IniciarJuego(List <be.Jugador> jugadores, bll.Ronda rondaServices)
        {
            be.Truco   truco   = new be.Truco();
            be.Partida partida = new be.Partida(jugadores);
            be.Turno   turno   = new be.Turno();
            turno.Jugador = jugadores[0];
            partida.Turno = turno;

            rondaServices.AsignarPartida(partida);
            rondaServices.CrearRonda();
            rondaServices.RepartirCartas(jugadores);

            return(partida);
        }
Пример #3
0
        public void TirarCarta(be.Jugador jugador, be.Carta carta, bll.Ronda rondaServices)
        {
            be.Partida partida = rondaServices.getPartida();
            int        index   = rondaServices.RondaActual;

            be.Mano mano = partida.Rondas[index].Manos[partida.Rondas[index].UltimaManoJugada];
            jugador.CartaJugada = carta;
            rondaServices.alternarTurno();

            int indice = jugador.Cartas.IndexOf(carta);

            jugador.Cartas[indice] = null;
            mano.Jugadores.Add(jugador);

            bll.Mano manoServices = new bll.Mano();
            manoServices.manoCompleta(mano, partida);
        }
Пример #4
0
        public void RepartirCartasTest()
        {
            List <be.Jugador> jugadores = new List <be.Jugador>();

            jugadores.Add(new be.Jugador("Pedro"));
            jugadores.Add(new be.Jugador("Juan"));

            be.Partida partida       = new be.Partida(jugadores);
            bll.Ronda  rondaServices = new bll.Ronda();
            rondaServices.AsignarPartida(partida);
            ronda = rondaServices.CrearRonda();

            rondaServices.RepartirCartas(jugadores);

            Assert.IsInstanceOfType(jugadores[0].Cartas[0], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[0].Cartas[1], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[0].Cartas[2], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[1].Cartas[0], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[1].Cartas[1], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[1].Cartas[2], typeof(be.Carta));
        }
Пример #5
0
        public void TirarCarta()
        {
            List <be.Jugador> jugadores = new List <be.Jugador>();

            jugadores.Add(new be.Jugador("Pedro"));
            jugadores.Add(new be.Jugador("Juan"));

            be.Partida partida       = new be.Partida(jugadores);
            bll.Ronda  rondaServices = new bll.Ronda();
            bll.Turno  turnoServices = new bll.Turno();
            rondaServices.AsignarPartida(partida);
            ronda = rondaServices.CrearRonda();

            be.Turno turno = turnoServices.cambiarTurno(new be.Turno(), jugadores[0]);
            rondaServices.RepartirCartas(jugadores);


            bll.Jugador jugadorServices = new bll.Jugador(jugadores);
            jugadorServices.TirarCarta(jugadores[0], jugadores[0].Cartas[1], ronda.Manos[0]);
            turnoServices.alternarTurno(turno, partida);

            Assert.IsInstanceOfType(ronda.Manos[0].Jugadores[0].CartaJugada, typeof(be.Carta));
        }