예제 #1
0
        public void InitializeTests()
        {
            _items = GenerateTalkItems(_theDate);

            var options = MockOptions.Create();

            options.GenerateTimingReports = false;
            options.MidWeekAdaptiveMode   = AdaptiveMode.TwoWay;
            options.MidWeekOrWeekend      = MidWeekOrWeekend.MidWeek;
            options.OperatingMode         = OperatingMode.Automatic;

            Mock <IOptionsService> optionsService = new Mock <IOptionsService>();

            optionsService.Setup(o => o.Options).Returns(options);
            optionsService.Setup(x => x.GetAdaptiveMode()).Returns(options.MidWeekAdaptiveMode);

            _scheduleService = new Mock <ITalkScheduleService>();
            _scheduleService.Setup(x => x.GetTalkScheduleItems()).Returns(_items);
            _scheduleService.Setup(x => x.GetTalkScheduleItem(It.IsAny <int>())).Returns((int id) => _items.Single(y => y.Id == id));

            _dateTimeService = new MockDateTimeService();
            _mtgStart        = _theDate + TimeSpan.FromHours(19); // 7pm
            _dateTimeService.Set(_mtgStart);

            _adaptiveTimerService = new AdaptiveTimerService(
                optionsService.Object, _scheduleService.Object, _dateTimeService);

            _adaptiveTimerService.SetMeetingStartTimeForTesting(_dateTimeService.UtcNow());

            // complete most of the timers...
            foreach (var item in _items)
            {
                if (item.Id == (int)TalkTypesAutoMode.LivingPart1)
                {
                    break;
                }

                // each item exactly on time
                item.CompletedTimeSecs = (int)item.ActualDuration.TotalSeconds;
            }
        }