public void MainViewModel_AlarmReminderManagerRequestNotification_TriggersView_WhenCalled() { var alarm = FakeAlarm.GetAlarm(AlarmStatus.Missed); this.alarmReminderManager.OnRequestNotification += Raise.EventWith(new AlarmReminderEventArgs(string.Empty, string.Empty)); this.view.ReceivedWithAnyArgs().ShowReminder(null, null); }
public void MainViewModel_AlarmServiceRemove_RemovesAlarmFromView() { var alarm = FakeAlarm.GetAlarm(); this.alarmService.Remove(alarm); this.view.Received().RemoveAlarm(alarm); }
public void MainViewModel_AlarmServiceAdd_AddsAlarmToView() { var alarm = FakeAlarm.GetAlarm(); this.alarmService.Add(alarm); this.view.Received().AddAlarm(alarm); }
public void FileAlarmRepository_Load_ReadsAlarmsFromDisk() { var alarm = FakeAlarm.GetAlarm(); var repository = this.CreateBlankRepository(); repository.Load(); this.sharedFileFactory.ReceivedWithAnyArgs().Read(null); }
public void FileAlarmRepository_Add_AddsItems() { var alarm = FakeAlarm.GetAlarm(); var repository = this.CreateBlankRepository(); repository.Save(new [] { alarm }); Assert.AreSame(alarm, this.serializeArgs.First()); }
public void MainViewModel_AlarmServiceAdd_StartsAlarm_WhenRingingAlarmAdded() { var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.Add(alarm); this.view.Received().PlayAlarm(); }
public void MainViewModel_AlarmStatusChange_PopsupView_ForMissedAlarms() { this.view.SetPopupOnAlarm(true); this.view.Visible = false; var alarm = FakeAlarm.GetAlarm(AlarmStatus.Missed); this.alarmService.TriggerAlarmStatusChange(alarm); this.view.Received().Show(); }
public void MainViewModel_AlarmServiceRemove_StopsAlarm_WhenRingingAlarmRemoved() { var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.Add(alarm); this.alarmService.Remove(alarm); this.view.Received().StopAlarm(); }
public void AlarmReminderManager_TimerTrigger_DoesNotTriggerOnRequestNotification_WhenMissingAlarmsExist() { var hasReceivedEvent = false; service.Add(FakeAlarm.GetAlarm(AlarmStatus.Completed)); manager.OnRequestNotification += (_, __) => hasReceivedEvent = true; timer.Elapsed += Raise.Event(); Assert.IsFalse(hasReceivedEvent); }
public void MainViewModel_AlarmStatusChange_PlaysAlarm_WhenSoundEnabled() { this.view.SetSound(true); var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.TriggerAlarmStatusChange(alarm); this.view.Received().PlayAlarm(); }
public void MainViewModel_AlarmStatusChange_DoesNotPlayAlarm_WhenSoundDisabled() { this.view.SetSound(false); var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.TriggerAlarmStatusChange(alarm); this.view.DidNotReceive().PlayAlarm(); }
public void MainViewModel_SoundChange_DoesNotPlayAlarm_WhenNoRingingAlarms() { this.view.SetSound(false); var alarm = FakeAlarm.GetAlarm(); this.alarmService.AddStorage(alarm); this.view.SetSound(true); this.view.DidNotReceive().PlayAlarm(); }
public void MainViewModel_SoundChange_StopsAlarm_WhenSoundDisabled() { this.view.SetSound(true); var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.Add(alarm); this.view.SetSound(false); this.view.Received().StopAlarm(); }
public void MainViewModel_SoundChange_PlaysAlarm_WhenSoundEnabled() { this.view.SetSound(false); var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.AddStorage(alarm); this.view.SetSound(true); this.view.Received().PlayAlarm(); }
public void FileAlarmRepository_Add_AddsMultipleItems() { var alarm1 = FakeAlarm.GetAlarm(); var alarm2 = FakeAlarm.GetAlarm(); var repository = this.CreateBlankRepository(); repository.Save(new [] { alarm1, alarm2 }); Assert.AreSame(alarm1, this.serializeArgs.First()); Assert.AreSame(alarm2, this.serializeArgs.Skip(1).First()); }
public void MainViewModel_AlarmStatusChange_DoesNotPopupView_WhenAlreadyVisible() { this.view.SetPopupOnAlarm(true); this.view.Visible = true; var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.TriggerAlarmStatusChange(alarm); this.view.DidNotReceive().Show(); }
public void FileAlarmRepository_List_ReturnsAlarms() { var alarm1 = FakeAlarm.GetAlarm(); this.storage.Add(alarm1); var repository = this.CreateBlankRepository(); var result = repository.Load(); Assert.AreEqual(1, result.Count()); Assert.AreSame(alarm1, result.First()); }
public void MainViewModel_AlarmStatusChange_PopsupView_WhenEnabledAndViewHidden() { this.view.SetPopupOnAlarm(true); this.view.Visible = false; var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.TriggerAlarmStatusChange(alarm); this.view.Received().Show(); }
public void MainViewModel_AlarmManagerWakeup_DoesNotRingAlarm_WhenNoRingingAlarms() { this.view.SetSmartAlarm(true); this.view.SetSound(true); var alarm = FakeAlarm.GetAlarm(); this.alarmService.AddStorage(alarm); this.alarmManager.OnWakeup += Raise.Event(); this.view.DidNotReceive().PlayAlarm(); }
public void MainViewModel_AlarmManagerWakeup_RingsAlarm_WhenAnyRingingAlarm() { this.view.SetSmartAlarm(true); this.view.SetSound(true); var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.AddStorage(alarm); this.alarmManager.OnWakeup += Raise.Event(); this.view.Received().PlayAlarm(); }
public void MainViewModel_AlarmManagerSleep_StopsAlarm_WhenAnyRingingAlarms() { this.view.SetSmartAlarm(true); this.view.SetSound(true); var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.Add(alarm); this.alarmManager.OnSleep += Raise.Event(); this.view.Received().StopAlarm(); }
public void MainViewModel_AlarmManagerWakeup_PopupView_WhenAnyRingingAlarm() { this.view.SetSmartAlarm(true); this.view.SetPopupOnAlarm(true); this.view.Visible = false; var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.AddStorage(alarm); this.alarmManager.OnWakeup += Raise.Event(); this.view.Received().Show(); }
public void MainViewModel_ViewSmartAlarmDisable_EnablesSound_WhenViewIsNotMuted() { this.view.SetSmartAlarm(true); this.view.SetSound(true); var alarm = FakeAlarm.GetAlarm(); alarm.IsRinging = true; this.alarmService.AddStorage(alarm); this.alarmManager.OnSleep += Raise.Event(); this.view.SetSmartAlarm(false); this.view.Received().PlayAlarm(); }
public void FileAlarmRepository_List_DoesNotReturnFilteredOutAlarms() { var alarm1 = FakeAlarm.GetAlarm(); var alarm2 = FakeAlarm.GetAlarm(); var filter = Substitute.For <IRepositoryFilter>(); filter.Match(alarm1).Returns(true); filter.Match(alarm2).Returns(false); this.storage.Add(alarm1); this.storage.Add(alarm2); var repository = this.CreateBlankRepository(filter); var result = repository.Load(); Assert.AreEqual(1, result.Count()); Assert.AreSame(alarm1, result.First()); }