/// <summary> /// Dado un perfil, busca en las tendencias de MercadoLibre regalos adecuados. /// </summary> /// <param name="idUsuario">Número identificador del perfil a buscar.</param> /// <returns>Sugerencia de búsqueda</returns> public string SugerenciaRegalo(long idUsuario) { Perfil target = BibliotecaPerfiles.GetUsuario(idUsuario); PipeInicial filtro = new PipeInicial(); return(filtro.Filtrar(target)); }
public void PrecioMaxMenorQuePrecioMinLanzaExcepcion() { BibliotecaPerfiles perfil = BibliotecaPerfiles.Instance; perfil.CrearUsuario(0); BibliotecaPerfiles.GetUsuario(0).PrecioMin = 500; Assert.Throws <ArgumentOutOfRangeException>(() => EditorPerfil.SetPrecioMax(0, 300)); }
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); }
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); }
public void EntradaDesconocidaSeteaDesconocido() { BibliotecaPerfiles biblioteca = BibliotecaPerfiles.Instance; biblioteca.CrearUsuario(0); Mensaje mensaje = new Mensaje("stub", 0, TipoPlataforma.Consola); ControlGeneroStub control = new ControlGeneroStub(); BibliotecaPerfiles.GetUsuario(0).RegistroPreguntas.Genero = true; control.Handle(mensaje); Assert.AreEqual(TipoGenero.Indefinido, BibliotecaPerfiles.GetUsuario(0).Genero); }