コード例 #1
0
        public void ctor_PresetContainsTimePointsWithSound_AddsSoundsToTheAlarm()
        {
            var preset = PresetFactory.GetPresetWithSounds();

            var pvm = GetPresetViewModel(preset);

            _mockAlarm.Verify(a => a.AddSound(It.IsAny <TimePoint>()), Times.Exactly(preset.TimePointCollection.Count));
        }
コード例 #2
0
        public void OnTimePointChanged_TimerEventArgsIsNotNull_CallsAlarmLoadNextSound()
        {
            var preset = PresetFactory.GetPresetWithSounds();
            var pvm    = GetPresetViewModel(preset);

            pvm.OnTimePointChanged(this, new TimerEventArgs(null, null, TimeSpan.Zero, null));

            _mockAlarm.Verify(a => a.LoadNextSound(It.IsAny <TimePoint>()), Times.Once);
        }
コード例 #3
0
        public void OnTimePointChanged_PrevIsRegularTimePoint_RingOnStartTime_CallsAlarmLoadNextSound()
        {
            var preset    = PresetFactory.GetPresetWithSounds();
            var pvm       = GetPresetViewModel(preset);
            var startTime = DateTime.Now.TimeOfDay + TimeSpan.FromSeconds(1);

            pvm.OnTimePointChanged(this, new TimerEventArgs(preset.TimePointCollection[0], preset.TimePointCollection[1], TimeSpan.FromSeconds(1), startTime));

            _mockAlarm.Verify(a => a.LoadNextSound(It.IsAny <TimePoint>()), Times.Once);
            _mockAlarm.Verify(a => a.Play(), Times.Once);
            _mockAlarm.Verify(a => a.PlayDefault(), Times.Never);
        }
コード例 #4
0
        public void OnTimePointChanged_PrevIsInitialTimePoint_CallsAlarmLoadNextSound()
        {
            var preset           = PresetFactory.GetPresetWithSounds();
            var pvm              = GetPresetViewModel(preset);
            var startTime        = DateTime.Now.TimeOfDay + TimeSpan.FromSeconds(1);
            var initialTimePoint = TimerManager.InitialTimePoint;
            var startTimePoint   = TimerManager.GetStartTimePoint(startTime);

            pvm.OnTimePointChanged(this, new TimerEventArgs(initialTimePoint, startTimePoint, TimeSpan.FromSeconds(1), startTime));

            _mockAlarm.Verify(a => a.LoadNextSound(It.IsAny <TimePoint>()), Times.Once);
            _mockAlarm.Verify(a => a.Play(), Times.Never);
            _mockAlarm.Verify(a => a.PlayDefault(), Times.Never);
        }
コード例 #5
0
        public void OnTimePointChanged_TimePointEventArgsIsNull_NotThrows()
        {
            var pvm = GetPresetViewModel(PresetFactory.GetPresetWithSounds());

            Assert.That(() => pvm.OnTimePointChanged(null, null), Throws.Nothing);
        }
コード例 #6
0
 public void ctor_IMainViewModelIsNull_Throws()
 {
     Assert.That(() => new PresetViewModel(PresetFactory.GetPresetWithSounds(), null), Throws.ArgumentNullException);
 }