コード例 #1
0
        public async Task GetAllEventsForAll()
        {
            var cb  = new CalendarBusiness();
            var sut = await cb.GetAllEvents();

            sut.Should().NotBeEmpty();
            sut.First().Summary.ShouldBeEquivalentTo("Anvil");
        }
コード例 #2
0
        public async Task TodayIsSundayShouldHaveEventsForNextWeek()
        {
            TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
            DateTime     easternTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone);
            var          cb          = new CalendarBusiness();
            var          sut         = await cb.GetAllEvents(false);

            sut.Count().Should().BeGreaterThan(1);
        }
コード例 #3
0
        public async Task GetAllEventsForWeek()
        {
            var cb  = new CalendarBusiness();
            var sut = await cb.GetAllEvents(false);

            sut.Should().NotBeEmpty();
            sut.First().Summary.ShouldBeEquivalentTo("Anvil");
            sut.Any(s => s.Summary == "SOBLSD").ShouldBeEquivalentTo(true);
            sut.FirstOrDefault(s => s.Summary == "SOBLSD").Items.EmptyIfNull().Should().HaveCount(1);
        }
コード例 #4
0
        public virtual async Task <ActionResult> All(bool all = true, bool bust = false)
        {
            var cacheKey = string.Format("{0}-{1}", "allcalenderitems", all.ToString());

            if (bust)
            {
                Cache.Remove(cacheKey);
            }
            var events = await Cache.GetOrSet("CalList", async() => await CalendarBusiness.GetAllEvents(all));

            return(Json(events, JsonRequestBehavior.AllowGet));
        }