public void PracticeRoutineEditViewModel_Remove_TimeSlotViewModel_Raises_ItemChanged() { var listChanged = false; var dialogService = new Mock <IDialogViewService>(); dialogService.Setup(ds => ds.YesNoPrompt(It.IsAny <string>(), It.IsAny <string>())).Returns(true); var practiceRoutine = EntityFactory.GetBasicPracticeRoutine(); var viewModel = new PracticeRoutineEditViewModel(dialogService.Object); viewModel.StartEdit(practiceRoutine); TimeSlotViewModel firstTimeSlot = viewModel.TimeSlots[0]; viewModel.TimeSlots.ListChanged += (s, e) => listChanged = true; viewModel.SelectedItem = firstTimeSlot; viewModel.DeleteCommand.Execute(null); Assert.IsTrue(listChanged); }
public void PracticeRoutineEditViewModel_When_TimeSlot_AssignedSeconds_Changes_Raises_PropertyChanged_TotalTimeDisplay() { var fired = false; var dialogService = new Mock <IDialogViewService>(); var practiceRoutine = EntityFactory.GetBasicPracticeRoutine(); var viewModel = new PracticeRoutineEditViewModel(dialogService.Object); viewModel.StartEdit(practiceRoutine); var firstTimeSlot = viewModel.TimeSlots[0]; viewModel.PropertyChanged += (s, e) => { if (e.PropertyName == "TotalTimeDisplay") { fired = true; } }; firstTimeSlot.AssignedSeconds = 600; Assert.IsTrue(fired); }
private void StartEditingPracticeRoutine(PracticeRoutine practiceRoutine) { practiceRoutineEditViewModel.StartEdit(practiceRoutine); NavigateTo("Edit"); }