Exemplo n.º 1
0
        private MeetingTimes StoreMidweekData(
            int week,
            int weekCount,
            DateTime dateOfMidweekMtg,
            DateTimeServiceForTests dateTimeService)
        {
            var startOfMtg = dateOfMidweekMtg + TimeSpan.FromHours(19);
            var plannedEnd = startOfMtg.AddMinutes(TotalMtgLengthMins);

            var service = new LocalTimingDataStoreService(null, dateTimeService);

            dateTimeService.Set(startOfMtg);

            service.InsertMeetingStart(startOfMtg);
            service.InsertPlannedMeetingEnd(plannedEnd);

            InsertTimer(service, dateTimeService, "Introductory Segment", true, false, 5, false);

            InsertTimer(service, dateTimeService, "Opening Comments", false, false, 3);

            InsertTimer(service, dateTimeService, "Treasures", false, false, 10);

            InsertTimer(service, dateTimeService, "Digging for Spiritual Gems", false, false, 8);

            InsertTimer(service, dateTimeService, "Bible Reading", false, true, 4);
            dateTimeService.Add(GetCounselDuration());

            InsertTimer(service, dateTimeService, "Ministry Talk 1", false, true, 2);
            dateTimeService.Add(GetCounselDuration());

            InsertTimer(service, dateTimeService, "Ministry Talk 2", false, true, 4);
            dateTimeService.Add(GetCounselDuration());

            InsertTimer(service, dateTimeService, "Ministry Talk 3", false, true, 6);
            dateTimeService.Add(GetCounselDuration());

            InsertTimer(service, dateTimeService, "Interim Segment", true, false, _interimDuration, false);

            InsertTimer(service, dateTimeService, "Living Item 1", false, false, 15);

            InsertTimer(service, dateTimeService, "Congregation Bible Study", false, false, 30);

            InsertTimer(service, dateTimeService, "Review", false, false, 3);

            InsertTimer(service, dateTimeService, "Concluding Segment", true, false, 5, false);

            service.InsertActualMeetingEnd(dateTimeService.Now());

            service.Save();

            if (week == weekCount - 1)
            {
                var file = TimingReportGeneration.ExecuteAsync(service, null).Result;
                Assert.IsNotNull(file);
            }

            return(service.MeetingTimes);
        }
Exemplo n.º 2
0
        private void WriteReport(DateTimeServiceForTests dateTimeService, MeetingTimes lastMtgTimes)
        {
            var service         = new LocalTimingDataStoreService(null, dateTimeService);
            var historicalTimes = service.GetHistoricalMeetingTimes();

            PdfTimingReport report = new PdfTimingReport(lastMtgTimes, historicalTimes, Path.GetTempPath());

            report.Execute();
        }
Exemplo n.º 3
0
 private void InsertTimer(
     LocalTimingDataStoreService service,
     DateTimeServiceForTests dateTimeService,
     string talkDescription,
     bool isSongSegment,
     bool isStudentTalk,
     int targetMins,
     bool addChangeoverTime = true)
 {
     InsertTimer(service, dateTimeService, talkDescription, isSongSegment, isStudentTalk, TimeSpan.FromMinutes(targetMins), addChangeoverTime);
 }
Exemplo n.º 4
0
 private void AddSpeakerChangeoverTime(DateTimeServiceForTests dateTimeService, bool isStudentTalk)
 {
     if (_useRandomTimes)
     {
         dateTimeService.Add(GetDuration(0.3));
     }
     else
     {
         if (!isStudentTalk)
         {
             dateTimeService.Add(new TimeSpan(0, 0, 20));
         }
     }
 }
Exemplo n.º 5
0
        public void TestReportGeneration()
        {
            var dateTimeService = new DateTimeServiceForTests();

            const int weekCount          = 20;
            var       dateOfFirstMeeting = GetNearestDayOnOrAfter(DateTime.Today.AddDays(-weekCount * 7), DayOfWeek.Sunday).Date;

            for (int wk = 0; wk < weekCount; ++wk)
            {
                var dateOfWeekendMtg = dateOfFirstMeeting.AddDays(wk * 7);
                var dateOfMidweekMtg = dateOfWeekendMtg.AddDays(4);

                StoreWeekendData(wk, dateOfWeekendMtg, dateTimeService);
                StoreMidweekData(wk, weekCount, dateOfMidweekMtg, dateTimeService);
            }
        }
Exemplo n.º 6
0
        private void InsertTimer(
            LocalTimingDataStoreService service,
            DateTimeServiceForTests dateTimeService,
            string talkDescription,
            bool isSongSegment,
            bool isStudentTalk,
            TimeSpan target,
            bool addChangeoverTime = true)
        {
            service.InsertTimerStart(talkDescription, isSongSegment, isStudentTalk, target, target);
            dateTimeService.Add(GetDuration(target.TotalMinutes));
            service.InsertTimerStop();

            if (addChangeoverTime)
            {
                // add an amount for speaker swap
                AddSpeakerChangeoverTime(dateTimeService, isStudentTalk);
            }
        }
Exemplo n.º 7
0
        private void StoreWeekendData(
            int week,
            DateTime dateOfWeekendMtg,
            DateTimeServiceForTests dateTimeService)
        {
            var startOfMtg = dateOfWeekendMtg + TimeSpan.FromHours(10);
            var plannedEnd = startOfMtg.AddMinutes(TotalMtgLengthMins);

            var service = new LocalTimingDataStoreService(null, dateTimeService);

            if (week == 0)
            {
                service.DeleteAllData();
            }

            dateTimeService.Set(startOfMtg);

            service.InsertMeetingStart(startOfMtg);
            service.InsertPlannedMeetingEnd(plannedEnd);

            dateTimeService.Add(TimeSpan.FromSeconds(1));

            // song and prayer
            InsertTimer(service, dateTimeService, "Introductory Segment", true, false, 5, false);

            // public talk...
            InsertTimer(service, dateTimeService, "Public Talk", false, false, 30);

            // song
            InsertTimer(service, dateTimeService, "Interim Segment", true, false, _interimDuration, false);

            // WT...
            InsertTimer(service, dateTimeService, "Watchtower Study", false, false, 60);

            InsertTimer(service, dateTimeService, "Concluding Segment", true, false, 5, false);

            service.InsertActualMeetingEnd(dateTimeService.Now());

            service.Save();
        }