public IEnumerable <BannerDTO> Get() { try { return(bannerService.GetAll()); } catch { throw new HttpResponseException(HttpStatusCode.NotFound); } }
public void GetAllBannerService() { var uow = new UnitOfWork(new DigitalSignageDbContext("DigitalSignageTest")); BannerService bS = new BannerService(); IEnumerable <BannerDTO> result = bS.GetAll(); IEnumerator <BannerDTO> e = result.GetEnumerator(); e.MoveNext(); Assert.IsNotNull(e.Current); }
public void CreateBannerService() { var uow = new UnitOfWork(new DigitalSignageDbContext("DigitalSignageTest")); BannerService cS = new BannerService(); BannerDTO BannerDTO = new BannerDTO(); BannerDTO.Name = "nueva campaña"; BannerDTO.Description = "qsy"; BannerDTO.InitDate = new DateTime().AddYears(2018); BannerDTO.EndDate = new DateTime().AddYears(2018); BannerDTO.InitTime = new TimeSpan(); BannerDTO.EndTime = new TimeSpan(); BannerDTO.Source = new RssSourceDTO() { Description = "fuente rss", Url = "Una url", RssItems = new List <RssItemDTO> { new RssItemDTO() { Description = "item rss", Url = "una url", Title = "titulo", PublishingDate = DateTime.Now } } }; try { cS.Create(BannerDTO); var result = cS.GetAll(); } catch (Exception e) { Assert.Fail(e.Message); } }