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)); }
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); }
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); }
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); }
public void OnTimePointChanged_TimePointEventArgsIsNull_NotThrows() { var pvm = GetPresetViewModel(PresetFactory.GetPresetWithSounds()); Assert.That(() => pvm.OnTimePointChanged(null, null), Throws.Nothing); }
public void ctor_IMainViewModelIsNull_Throws() { Assert.That(() => new PresetViewModel(PresetFactory.GetPresetWithSounds(), null), Throws.ArgumentNullException); }