public void End()
        {
            _dtoApuestaVOF      = null;
            _dtoApuestaJugador  = null;
            _dtoApuestaEquipo   = null;
            _dtoApuestaCantidad = null;

            _apuestaVoF      = null;
            _apuestaCantidad = null;
            _apuestaEquipo   = null;
            _apuestaJugador  = null;

            _traductorApuestaCantidad = null;
            _traductorApuestaJugador  = null;
            _traductorApuestaEquipo   = null;
            _traductorApuestaVoF      = null;


            _logroVoF      = null;
            _logroCantidad = null;
            _logroJugador  = null;
            _logroEquipo   = null;

            _apostador = null;

            _equiposEstaticos = null;
        }
        public void TraducirDTOApuestaCantidadTest()
        {
            DTOApuestaCantidad _dtoEsperado = FabricaDTO.CrearDtoApuestaCantidad();

            _dtoEsperado.IdLogro        = 1;
            _dtoEsperado.IdUsuario      = 1;
            _dtoEsperado.ApuestaUsuario = 1;
            _dtoEsperado.Estado         = "en curso";


            _apuestaCantidad = FabricaEntidades.CrearApuestaCantidad();

            _apuestaCantidad.Logro     = _logroCantidad as LogroCantidad;
            _apuestaCantidad.Usuario   = _apostador;
            _apuestaCantidad.Respuesta = 1;
            _apuestaCantidad.Estado    = "en curso";

            _traductorApuestaCantidad = FabricaTraductor.CrearTraductorApuestaCantidad();

            _dtoApuestaCantidad = _traductorApuestaCantidad.CrearDto(_apuestaCantidad);

            Assert.AreEqual(_dtoEsperado.IdLogro, _dtoApuestaCantidad.IdLogro);
            Assert.AreEqual(_dtoEsperado.IdUsuario, _dtoApuestaCantidad.IdUsuario);
            Assert.AreEqual(_dtoEsperado.ApuestaUsuario, _dtoApuestaCantidad.ApuestaUsuario);
            Assert.AreEqual(_dtoEsperado.Estado, _dtoApuestaCantidad.Estado);
        }
Exemplo n.º 3
0
        public HttpResponseMessage ActualizarApuestaCantidad(DTOApuestaCantidad dto)
        {
            try
            {
                TraductorApuestaCantidad traductor = FabricaTraductor.CrearTraductorApuestaCantidad();

                Entidad apuesta = traductor.CrearEntidad(dto);

                Comando comando = FabricaComando.CrearComandoActualizarApuestaCantidad(apuesta);

                comando.Ejecutar();

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (ObjetoNullException exc)
            {
                log.Error(exc, exc.Mensaje);

                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Mensaje));
            }
            catch (BaseDeDatosException exc)
            {
                log.Error(exc, exc.Mensaje);

                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Mensaje));
            }
            catch (ApuestaInvalidaException exc)
            {
                log.Error(exc, exc.Mensaje);

                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Mensaje));
            }
            catch (Exception exc)
            {
                ExcepcionGeneral exceptionGeneral = new ExcepcionGeneral(exc.InnerException, DateTime.Now);

                log.Error(exc, exc.Message);

                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exceptionGeneral.Mensaje));
            }
        }
        public void TraducirApuestaCantidadTest()
        {
            ApuestaCantidad _apuestaEsperada = FabricaEntidades.CrearApuestaCantidad();

            _apuestaEsperada.Respuesta = 1;
            _apuestaEsperada.Logro     = _logroCantidad;
            _apuestaEsperada.Usuario   = _apostador;


            _dtoApuestaCantidad = FabricaDTO.CrearDtoApuestaCantidad();

            _dtoApuestaCantidad.IdLogro        = 1;
            _dtoApuestaCantidad.IdUsuario      = 1;
            _dtoApuestaCantidad.ApuestaUsuario = 1;


            _traductorApuestaCantidad = FabricaTraductor.CrearTraductorApuestaCantidad();

            _apuestaCantidad = _traductorApuestaCantidad.CrearEntidad(_dtoApuestaCantidad) as ApuestaCantidad;

            Assert.AreEqual(_apuestaEsperada.Logro.Id, _apuestaCantidad.Logro.Id);
            Assert.AreEqual(_apuestaEsperada.Usuario.Id, _apuestaCantidad.Usuario.Id);
            Assert.AreEqual(_apuestaEsperada.Respuesta, _apuestaCantidad.Respuesta);
        }