Esempio n. 1
0
        /// <summary>
        /// Verifica la existencia del Perfil en el sistema, y continúa (o comienza) la interacción.
        /// </summary>
        /// <param name="mensaje">Mensaje recibido desde Plataforma, que contiene el ID de la conversación.</param>
        public static async void BuscarUsuario(Mensaje mensaje)
        {
            if (!deposito.ExisteUsuario(mensaje.Id))
            {
                deposito.CrearUsuario(mensaje.Id);

                string pregunta = Respuesta.DefinirFrase("saludo");
                await Respuesta.GenerarRespuesta(pregunta, mensaje.Id, mensaje.Plataforma);
            }

            handler.Handle(mensaje);
        }
        public void NoIngresaNumeroLanzaExcepcion()
        {
            Library.BibliotecaPerfiles biblioteca = Library.BibliotecaPerfiles.Instance;
            biblioteca.CrearUsuario(0);
            Mensaje mensaje = new Mensaje("stub", 0, TipoPlataforma.Consola);
            ControlPrecioMaxStub control = new ControlPrecioMaxStub();

            BibliotecaPerfiles.GetUsuario(0).RegistroPreguntas.PrecioMax = true;

            control.Handle(mensaje);

            Assert.Throws <FormatException>(() => Int32.Parse(mensaje.Contenido));
        }
        public void SiPrecioMaxCorrectoSeteaPerfil()
        {
            Library.BibliotecaPerfiles biblioteca = Library.BibliotecaPerfiles.Instance;
            biblioteca.CrearUsuario(0);
            Mensaje mensaje = new Mensaje("25", 0, TipoPlataforma.Consola);
            ControlPrecioMaxStub control = new ControlPrecioMaxStub();

            BibliotecaPerfiles.GetUsuario(0).RegistroPreguntas.PrecioMax = true;

            control.Handle(mensaje);

            Assert.AreEqual(BibliotecaPerfiles.GetUsuario(0).PrecioMax, 25);
        }
        public void SiTodoOKContinuoASiguienteEslabon()
        {
            Library.BibliotecaPerfiles biblioteca = Library.BibliotecaPerfiles.Instance;
            biblioteca.CrearUsuario(0);
            Mensaje            mensaje = new Mensaje("Rock", 0, TipoPlataforma.Consola);
            ControlInteresStub control = new ControlInteresStub();

            BibliotecaPerfiles.GetUsuario(0).RegistroPreguntas.Interes = true;

            control.Handle(mensaje);

            Assert.IsTrue(control.passed);
        }
Esempio n. 5
0
        public void SiTodoOKSeteaEdad()
        {
            Library.BibliotecaPerfiles biblioteca = Library.BibliotecaPerfiles.Instance;
            biblioteca.CrearUsuario(0);
            Mensaje         mensaje = new Mensaje("25", 0, TipoPlataforma.Consola);
            ControlEdadStub control = new ControlEdadStub();

            BibliotecaPerfiles.GetUsuario(0).RegistroPreguntas.Edad = true;

            control.Handle(mensaje);

            Assert.AreEqual(BibliotecaPerfiles.GetUsuario(0).Edad, 25);
        }