コード例 #1
0
 public IEnumerable <BannerDTO> Get()
 {
     try
     {
         return(bannerService.GetAll());
     }
     catch
     {
         throw new HttpResponseException(HttpStatusCode.NotFound);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
            }
        }