public async Task AnunciantesServices_ListarAnunciosDeUnAnunciante_ShouldList()
        {
            AnunciantesServices anuncianteServices = new AnunciantesServices();

            AnunciosDTO anuncio = new AnunciosDTO
            {
                SkipIndexBase           = 0,
                TakeIndexBase           = 20,
                CodigoAnunciante        = 1,
                CodigoIdiomaUsuarioBase = 1
            };

            List <AnunciosDTO> lstAnuncios = await anuncianteServices.ListarAnunciosDeUnAnunciante(anuncio);

            Assert.IsNotNull(lstAnuncios);
            Assert.IsTrue(lstAnuncios.Count > 0);
            Assert.IsTrue(lstAnuncios.TrueForAll(x => x.Anunciantes == null));
            Assert.IsTrue(lstAnuncios.TrueForAll(x => x.Archivos == null));
        }
예제 #2
0
        public async Task <JsonResult> GetListPostsByAdvertiser(AnunciosDTO posts)
        {
            Result <AnunciosDTO> result = new Result <AnunciosDTO>();

            try
            {
                AnunciantesServices categoryService = new AnunciantesServices();
                var ass = UserLoggedIn();
                posts.CodigoAnunciante        = UserLoggedIn().PersonaDelUsuario.AnuncianteDeLaPersona.Consecutivo;
                posts.CodigoIdiomaUsuarioBase = UserLoggedIn().PersonaDelUsuario.CodigoIdioma;
                result.list = await categoryService.ListarAnunciosDeUnAnunciante(posts);

                if (result.list == null)
                {
                    return(Json(Helper.returnErrorList(UserLoggedIn().PersonaDelUsuario.CodigoIdioma), JsonRequestBehavior.AllowGet));
                }

                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(Helper.returnErrorList(UserLoggedIn().PersonaDelUsuario.CodigoIdioma), JsonRequestBehavior.AllowGet));
            }
        }