private void SeedBanners(DigitalSignageContext pContext)
        {
            IList <Schedule> lDateIntervalList = pContext.DateIntervals.ToList();
            Banner           lBanner1          = new Banner()
            {
                Name        = "Noticias de deporte",
                Description = "Noticias de la actualidad deportiva, provenientes de distintas fuentes. Tambien contiene otros textos útiles",
                //falta contenido, pero eso falta tratar los rss
            };

            var query = from interval in lDateIntervalList
                        where interval.ActiveDays.Count() == 5
                        select interval;

            foreach (var interval in query)
            {
                lBanner1.AddSchedule(DomainServiceLocator.Resolve <IScheduleChecker>(), interval);
            }
            ;

            lBanner1.AddBannerItem(pContext.Texts.ToList()[3]);
            lBanner1.AddBannerItem(pContext.Texts.ToList()[4]);
            //IList<RssSource> lista = pContext.RssSources.ToList();
            lBanner1.AddSource(pContext.RssSources.ToList()[0]);
            lBanner1.AddSource(pContext.RssSources.ToList()[2]);
            pContext.Banners.Add(lBanner1);
        }
Exemplo n.º 2
0
        public void ActiveForDate_IsActive()
        {
            Banner lBanner = new Banner()
            {
                Name = "Informacion deportiva", Description = "Noticias del ámbito deportivo nacional de distintas fuentes"
            };

            Schedule lInterval = new Schedule()
            {
                Name = "Mes de febrero, de lunes a viernes por la mañana", ActiveUntil = new DateTime(2016, 2, 29), ActiveFrom = new DateTime(2016, 2, 1)
            };

            Day lDay1 = new Day()
            {
                Id = 1, Value = Days.Lunes
            };
            Day lDay2 = new Day()
            {
                Id = 2, Value = Days.Martes
            };
            Day lDay3 = new Day()
            {
                Id = 3, Value = Days.Miercoles
            };
            Day lDay4 = new Day()
            {
                Id = 4, Value = Days.Jueves
            };
            Day lDay5 = new Day()
            {
                Id = 5, Value = Days.Viernes
            };

            lInterval.AddDay(lDay1);
            lInterval.AddDay(lDay2);
            lInterval.AddDay(lDay3);
            lInterval.AddDay(lDay4);
            lInterval.AddDay(lDay5);

            TimeSpan time1 = new TimeSpan(8, 0, 0);
            TimeSpan time2 = new TimeSpan(12, 0, 0);

            ScheduleEntry lTimeInterval = new ScheduleEntry()
            {
                End = time2, Start = time1
            };

            lInterval.AddTimeInterval(lTimeInterval);

            lBanner.AddSchedule(DomainServiceLocator.Resolve <IScheduleChecker>(), lInterval);

            DateTime lDate = new DateTime(2016, 2, 4, 20, 0, 0);

            bool lResult = lBanner.IsActiveAt(DomainServiceLocator.Resolve <IScheduleChecker>(), lDate);

            Assert.IsFalse(lResult);
        }